It is otherwise idential to a standard socket.
Socket connection can be either blocking or nonblocking. Use of the standard constructors causes the current thread to block until the connection is established. Otherwise, there are 3 ways to check if the connection has been established: (1) Call finishConnection, (2) Call connectDone, or (3) Create a SelectSet and select on the event Selectable.CONNECT_READY, then call connectDone.
Public Member Functions | |
| NonblockingSocket (String host, int port) throws UnknownHostException, IOException | |
| Create a NonblockingSocket connection to the given host and port number. | |
| NonblockingSocket (String host, int port, boolean block) throws UnknownHostException, IOException | |
| Create a NonblockingSocket connection to the given host and port number. | |
| NonblockingSocket (InetAddress address, int port) throws UnknownHostException, IOException | |
| Create a NonblockingSocket connection to the given host and port number. | |
| NonblockingSocket (InetAddress address, int port, boolean block) throws IOException | |
| Create a NonblockingSocket connection to the given host and port number. | |
| boolean | finishConnect (int timeout) throws SocketException |
| Block until the connection on this socket has been established. | |
| boolean | connectDone () throws SocketException |
| Indicate whether the connection on this socket has been established. | |
| InetAddress | getInetAddress () |
| Return the remote address to which this socket is bound. | |
| InetAddress | getLocalAddress () |
| Return the local address to which this socket is bound. | |
| int | getPort () |
| Return the remote port to which this socket is bound. | |
| int | getLocalPort () |
| Return the local port to which this socket is bound. | |
| InputStream | getInputStream () throws IOException |
| Return an InputStream from which data on this socket can be read. | |
| OutputStream | getOutputStream () throws IOException |
| Return an OutputStream to which data on this socket can be written. | |
| void | setTcpNoDelay (boolean on) throws SocketException |
| Currently unimplemented. | |
| boolean | getTcpNoDelay () throws SocketException |
| Currently unimplemented. | |
| void | setSoLinger (boolean on, int val) throws SocketException |
| Currently unimplemented. | |
| int | getSoLinger () throws SocketException |
| Currently unimplemented. | |
| synchronized void | setSoTimeout (int timeout) throws SocketException |
| Currently unimplemented. | |
| synchronized int | getSoTimeout () throws SocketException |
| Currently unimplemented. | |
| synchronized void | close () throws IOException |
| Closes the socket. | |
| String | toString () |
Package Functions | |
| NonblockingSocket () throws IOException | |
Static Package Functions | |
| static void | loadNativeLibrary () |
| [static initializer] | |
Package Attributes | |
| NonblockingSocketImpl | impl |
| boolean | is_connected |
Static Package Attributes | |
| static boolean | nativeLibraryLoaded = false |
| static Object | nativeLibraryLoadLock = new Object() |
| seda.nbio.NonblockingSocket.NonblockingSocket | ( | ) | throws IOException [package] |
| seda.nbio.NonblockingSocket.NonblockingSocket | ( | String | host, | |
| int | port | |||
| ) | throws UnknownHostException, IOException |
Create a NonblockingSocket connection to the given host and port number.
This will block until the connection is established.
| seda.nbio.NonblockingSocket.NonblockingSocket | ( | String | host, | |
| int | port, | |||
| boolean | block | |||
| ) | throws UnknownHostException, IOException |
Create a NonblockingSocket connection to the given host and port number.
If 'block' is true, block until the connection is done.
| seda.nbio.NonblockingSocket.NonblockingSocket | ( | InetAddress | address, | |
| int | port | |||
| ) | throws UnknownHostException, IOException |
Create a NonblockingSocket connection to the given host and port number.
This will block until the connection is established.
| seda.nbio.NonblockingSocket.NonblockingSocket | ( | InetAddress | address, | |
| int | port, | |||
| boolean | block | |||
| ) | throws IOException |
Create a NonblockingSocket connection to the given host and port number.
If 'block' is true, block until the connection is done.
| static void seda.nbio.NonblockingSocket.loadNativeLibrary | ( | ) | [static, package] |
| seda.nbio.NonblockingSocket.[static initializer] | ( | ) | [static, package] |
| boolean seda.nbio.NonblockingSocket.finishConnect | ( | int | timeout | ) | throws SocketException |
Block until the connection on this socket has been established.
'timeout' specifies the maximum number of milliseconds to block. A timeout of zero indicates no blocking (in which case this call is equivalent to connectDone). A timeout of -1 causes this call to block indefinitely until the connection is established.
| boolean seda.nbio.NonblockingSocket.connectDone | ( | ) | throws SocketException |
Indicate whether the connection on this socket has been established.
Throws an exception if an error occurred trying to connect.
| InetAddress seda.nbio.NonblockingSocket.getInetAddress | ( | ) |
Return the remote address to which this socket is bound.
| InetAddress seda.nbio.NonblockingSocket.getLocalAddress | ( | ) |
Return the local address to which this socket is bound.
| int seda.nbio.NonblockingSocket.getPort | ( | ) |
Return the remote port to which this socket is bound.
| int seda.nbio.NonblockingSocket.getLocalPort | ( | ) |
Return the local port to which this socket is bound.
| InputStream seda.nbio.NonblockingSocket.getInputStream | ( | ) | throws IOException |
Return an InputStream from which data on this socket can be read.
The returned InputStream is actually a NonblockingInputStream and provides nonblocking semantics.
| OutputStream seda.nbio.NonblockingSocket.getOutputStream | ( | ) | throws IOException |
Return an OutputStream to which data on this socket can be written.
The returned OutputStream is actually a NonblockingOutputStream and provides nonblocking semantics.
| void seda.nbio.NonblockingSocket.setTcpNoDelay | ( | boolean | on | ) | throws SocketException |
Currently unimplemented.
| boolean seda.nbio.NonblockingSocket.getTcpNoDelay | ( | ) | throws SocketException |
Currently unimplemented.
| void seda.nbio.NonblockingSocket.setSoLinger | ( | boolean | on, | |
| int | val | |||
| ) | throws SocketException |
Currently unimplemented.
| int seda.nbio.NonblockingSocket.getSoLinger | ( | ) | throws SocketException |
Currently unimplemented.
| synchronized void seda.nbio.NonblockingSocket.setSoTimeout | ( | int | timeout | ) | throws SocketException |
Currently unimplemented.
| synchronized int seda.nbio.NonblockingSocket.getSoTimeout | ( | ) | throws SocketException |
Currently unimplemented.
| synchronized void seda.nbio.NonblockingSocket.close | ( | ) | throws IOException |
Closes the socket.
| String seda.nbio.NonblockingSocket.toString | ( | ) |
boolean seda.nbio.NonblockingSocket.is_connected [package] |
boolean seda.nbio.NonblockingSocket.nativeLibraryLoaded = false [static, package] |
Object seda.nbio.NonblockingSocket.nativeLibraryLoadLock = new Object() [static, package] |
1.5.1