seda.sandStorm.lib.aSocket
Class ATcpServerSocket

java.lang.Object
  extended by seda.sandStorm.lib.aSocket.ATcpServerSocket

public class ATcpServerSocket
extends java.lang.Object

This class represents an asynchronous server socket. An application creates an ATcpServerSocket to listen for incoming TCP connections on a given port; when a connection is received, an ATcpConnection object is pushed to the SinkIF associated with the ATcpServerSocket. The ATcpConnection is then used for communication.

See Also:
ATcpConnection

Field Summary
 ListenSockState lss
          Internal state used by aSocket implementation
(package private)  int serverPort
           
 
Constructor Summary
protected ATcpServerSocket()
           
  ATcpServerSocket(int serverPort, SinkIF compQ)
          Open a server socket listening on the given port.
  ATcpServerSocket(int serverPort, SinkIF compQ, int writeClogThreshold)
          Open a server socket listening on the given port.
 
Method Summary
 void close()
          Asynchronously close this server socket.
 int getLocalPort()
          Return the local port for this socket.
 int getPort()
          Return the port that this socket is listening on.
 void resumeAccept()
          Request that this server socket resume accepting new connections.
 void suspendAccept()
          Request that this server socket stop accepting new connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lss

public ListenSockState lss
Internal state used by aSocket implementation


serverPort

int serverPort
Constructor Detail

ATcpServerSocket

public ATcpServerSocket(int serverPort,
                        SinkIF compQ)
                 throws java.io.IOException
Open a server socket listening on the given port. When a connection arrives, an ATcpConnection will be posted to the given compQ. If the server socket dies, an ATcpServerSocketDeadEvent will be posted instead.

Throws:
java.io.IOException

ATcpServerSocket

public ATcpServerSocket(int serverPort,
                        SinkIF compQ,
                        int writeClogThreshold)
                 throws java.io.IOException
Open a server socket listening on the given port. When a connection arrives, an ATcpConnection will be posted to the given compQ. If the server socket dies, an ATcpServerSocketDeadEvent will be posted instead.

Parameters:
writeClogThreshold - The maximum number of outstanding write requests to a connection established using this socket before a SinkCloggedEvent is pushed onto the completion queue for that connection. The default value is -1, which indicates that no SinkCloggedEvents will be generated.
Throws:
java.io.IOException

ATcpServerSocket

protected ATcpServerSocket()
Method Detail

suspendAccept

public void suspendAccept()
Request that this server socket stop accepting new connections. This request will not take effect immediately.


resumeAccept

public void resumeAccept()
Request that this server socket resume accepting new connections. This request will not take effect immediately.


getPort

public int getPort()
Return the port that this socket is listening on.


getLocalPort

public int getLocalPort()
Return the local port for this socket. Returns -1 if no local port has yet been established.


close

public void close()
Asynchronously close this server socket. An ATcpServerSocketClosedEvent will be posted to the completion queue associated with this server socket when the close completes.