| java.lang.Object java.net.Socket seda.nbio.NonblockingSocket
NonblockingSocket | public class NonblockingSocket extends Socket implements Selectable(Code) | | A NonblockingSocket is a socket which exports nonblocking input/output
streams. 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 .
See Also: SelectSet |
Method Summary | |
public synchronized void | close() Closes the socket. | public boolean | connectDone() Indicate whether the connection on this socket has been established. | public boolean | finishConnect(int timeout) 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 ). | public InetAddress | getInetAddress() Return the remote address to which this socket is bound. | public InputStream | getInputStream() Return an InputStream from which data on this socket can be read. | public InetAddress | getLocalAddress() Return the local address to which this socket is bound. | public int | getLocalPort() Return the local port to which this socket is bound. | public OutputStream | getOutputStream() Return an OutputStream to which data on this socket can be written. | public int | getPort() Return the remote port to which this socket is bound. | public int | getSoLinger() Currently unimplemented. | public synchronized int | getSoTimeout() Currently unimplemented. | public boolean | getTcpNoDelay() Currently unimplemented. | static void | loadNativeLibrary() | public void | setSoLinger(boolean on, int val) Currently unimplemented. | public synchronized void | setSoTimeout(int timeout) Currently unimplemented. | public void | setTcpNoDelay(boolean on) Currently unimplemented. | public String | toString() |
is_connected | boolean is_connected(Code) | | |
nativeLibraryLoadLock | static Object nativeLibraryLoadLock(Code) | | |
nativeLibraryLoaded | static boolean nativeLibraryLoaded(Code) | | |
NonblockingSocket | public NonblockingSocket(String host, int port) throws UnknownHostException, IOException(Code) | | Create a NonblockingSocket connection to the given host and port number.
This will block until the connection is established.
|
NonblockingSocket | public NonblockingSocket(String host, int port, boolean block) throws UnknownHostException, IOException(Code) | | Create a NonblockingSocket connection to the given host and port number.
If 'block' is true, block until the connection is done.
|
NonblockingSocket | public NonblockingSocket(InetAddress address, int port) throws UnknownHostException, IOException(Code) | | Create a NonblockingSocket connection to the given host and port number.
This will block until the connection is established.
|
NonblockingSocket | public NonblockingSocket(InetAddress address, int port, boolean block) throws IOException(Code) | | Create a NonblockingSocket connection to the given host and port number.
If 'block' is true, block until the connection is done.
|
connectDone | public boolean connectDone() throws SocketException(Code) | | Indicate whether the connection on this socket has been established.
Throws an exception if an error occurred trying to connect.
|
finishConnect | public boolean finishConnect(int timeout) throws SocketException(Code) | | 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.
true is the connection was established, false if still pending. |
getInetAddress | public InetAddress getInetAddress()(Code) | | Return the remote address to which this socket is bound.
|
getInputStream | public InputStream getInputStream() throws IOException(Code) | | Return an InputStream from which data on this socket can be read.
The returned InputStream is actually a NonblockingInputStream
and provides nonblocking semantics.
|
getLocalAddress | public InetAddress getLocalAddress()(Code) | | Return the local address to which this socket is bound.
|
getLocalPort | public int getLocalPort()(Code) | | Return the local port to which this socket is bound.
|
getOutputStream | public OutputStream getOutputStream() throws IOException(Code) | | Return an OutputStream to which data on this socket can be written.
The returned OutputStream is actually a NonblockingOutputStream
and provides nonblocking semantics.
|
getPort | public int getPort()(Code) | | Return the remote port to which this socket is bound.
|
loadNativeLibrary | static void loadNativeLibrary()(Code) | | |
setSoLinger | public void setSoLinger(boolean on, int val) throws SocketException(Code) | | Currently unimplemented.
|
setSoTimeout | public synchronized void setSoTimeout(int timeout) throws SocketException(Code) | | Currently unimplemented.
|
|
|