|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MultiplexSocketConnector
The MultiplexSocketConnector class is the access point to get client
socket connections in the multiplex logic. Its functionality is similar to the
traditional server socket, which gives you the next socket connection upon calling
the accept() method.
A connector instance can be created using the createSocketConnector()
method of the class MultiplexServerSocket, providing a StreamSelector
object. Upon this call, the server socket will create a new connector instance that will
be associated to the server socket. The selector passed in will be used to determine
if this connector will handle or not a new client socket connection. After you need to call
the accept() to get the next client socket connection (blocking call). Finally
when you are done with this socket connector a call to the close() method is
required to release all the resource used by this socket connector. Note that closing the
socket connector will not close the underlying server socket.
All the accessor methods that returns a state delegates the call to the underlying
server socket. For example a call to get the port number on which is connector is bound
to, using the getLocalPort() method, will pass the request to the server
socket that is associated with this socket connector.
MultiplexServerSocket,
StreamSelector| Method Summary | |
|---|---|
java.net.Socket |
accept()
Listens for a connection to be made to this socket and accepts it. |
void |
close()
Closes this multiplex socket handler. |
java.net.InetAddress |
getInetAddress()
Returns the local address of this server socket. |
int |
getLocalPort()
Returns the port on which this socket is listening. |
java.net.SocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. |
int |
getReceiveBufferSize()
Gets the value of the SO_RCVBUF option for this socket interceptor that is the proposed buffer size that will be used for Sockets accepted from this socket interceptor. |
boolean |
getReuseAddress()
Tests if SO_REUSEADDR is enabled. |
int |
getSoTimeout()
Retrieve setting for SO_TIMEOUT. |
boolean |
isBound()
Returns the binding state of the socket. |
boolean |
isClosed()
Returns the closed state of the socket. |
| Method Detail |
|---|
int getLocalPort()
java.net.InetAddress getInetAddress()
null if the socket is unbound.java.net.SocketAddress getLocalSocketAddress()
null if it is not bound yet.
SocketAddress representing the local endpoint of this
socket, or null if it is not bound yet.
int getReceiveBufferSize()
throws java.net.SocketException
java.net.SocketException - if there is an error in the underlying protocol.
boolean getReuseAddress()
throws java.net.SocketException
boolean indicating whether or not SO_REUSEADDR is enabled.
java.net.SocketException - if there is an error in the underlying protocol.
int getSoTimeout()
throws java.io.IOException
java.io.IOException - if an I/O error occursboolean isBound()
boolean isClosed()
java.net.Socket accept()
throws java.io.IOException
java.io.IOException - If an I/O error occurs when waiting for a connection.
void close()
throws java.io.IOException
java.io.IOException - if an I/O error occurs when closing the socket.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||