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() |
|
|
|
|
||||||||||||
|
Create a NonblockingSocket connection to the given host and port number. This will block until the connection is established. |
|
||||||||||||||||
|
Create a NonblockingSocket connection to the given host and port number. If 'block' is true, block until the connection is done. |
|
||||||||||||
|
Create a NonblockingSocket connection to the given host and port number. This will block until the connection is established. |
|
||||||||||||||||
|
Create a NonblockingSocket connection to the given host and port number. If 'block' is true, block until the connection is done. |
|
|
|
|
|
Closes the socket.
|
|
|
Indicate whether the connection on this socket has been established. Throws an exception if an error occurred trying to connect. |
|
|
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
|
|
|
Return the remote address to which this socket is bound.
|
|
|
Return an InputStream from which data on this socket can be read. The returned InputStream is actually a NonblockingInputStream and provides nonblocking semantics. |
|
|
Return the local address to which this socket is bound.
|
|
|
Return the local port to which this socket is bound.
|
|
|
Return an OutputStream to which data on this socket can be written. The returned OutputStream is actually a NonblockingOutputStream and provides nonblocking semantics. |
|
|
Return the remote port to which this socket is bound.
|
|
|
Currently unimplemented.
|
|
|
Currently unimplemented.
|
|
|
Currently unimplemented.
|
|
|
|
|
||||||||||||
|
Currently unimplemented.
|
|
|
Currently unimplemented.
|
|
|
Currently unimplemented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.2