|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimnet.ServerSocket
A TCP Server Socket. Need to use statistics.
| Field Summary | |
protected int |
backlog
Maximum number of unaccepted connections (size of incomplete and complete queues cannot exceed this). |
(package private) java.util.LinkedList |
completeCQ
The list of connections ready to be accepted. |
protected int |
connectionTimeout
The timeout when trying accepting a connection (0=wait forever). |
protected java.lang.Object |
consumer
The consumer that owns this socket. |
static int |
CONSUMER_ID
The notification code when the consumer gets plugged out (randomly chosen to avoid conflicts) |
static int |
DEFAULT_QUEUE_SIZE
The default size of the send and receive queues. |
(package private) java.util.HashSet |
incompleteCQ
The set of half-open connections that have not been accepted. |
protected int |
port
The port this socket is listening on (-1 for unbound). |
protected Simulator |
sim
For convienence, keep a reference to the simulator around. |
protected int |
state
The TCP state of this socket |
protected ServerSocketStatistics |
stats
Keep track of our statistics. |
protected TCP |
tcp
A pointer to a TCP object |
| Constructor Summary | |
(package private) |
ServerSocket(TCP tcp_transport,
java.lang.Object c)
Constructs a newly allocated ServerSocket object using the specified transport, with the specified consumer. |
| Method Summary | |
Socket |
accept()
Accept completed connections from this socket if one is available within connectionTimeout ms. |
void |
bind(int port)
Bind this socket to the specified port. |
void |
close()
Close this server socket. |
void |
finalize()
|
int |
getBacklog()
Return the number of unaccepted connections. |
int |
getBacklogLimit()
Returns the maximum number of unaccepted connections. |
boolean |
isBound()
Returns if this socket is bound to a local port. |
boolean |
isClosed()
Returns if this socket has been closed (after being used). |
void |
listen(int backlog)
Get a socket ready to accept connections supporting the specified number of unaccepted connections. |
void |
plugoutNotification(int id,
java.lang.Object replacement,
java.lang.Object[] args)
When the consumer is getting plugged out, close this socket. |
void |
setConnectionTimeout(int cto)
Sets the connection timeout to the specified value (0=wait forever) in ms. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int CONSUMER_ID
public static final int DEFAULT_QUEUE_SIZE
protected Simulator sim
protected int state
protected int port
protected int connectionTimeout
protected TCP tcp
protected java.lang.Object consumer
protected int backlog
java.util.HashSet incompleteCQ
java.util.LinkedList completeCQ
protected ServerSocketStatistics stats
| Constructor Detail |
ServerSocket(TCP tcp_transport,
java.lang.Object c)
| Method Detail |
public boolean isClosed()
public boolean isBound()
public void setConnectionTimeout(int cto)
throws SimnetSocketException
SimnetSocketException - if the parameter is negative.
public void bind(int port)
throws SimnetSocketException
port - The port number to bind to
SimnetSocketException - if this socket is already bound, is an invalid port
or the port is already in use.
public void listen(int backlog)
throws SimnetSocketException
SimnetSocketException - if the socket is already used, or is not boundpublic int getBacklog()
public int getBacklogLimit()
public Socket accept()
throws SimnetSocketException,
java.lang.InterruptedException
SimnetSocketException - if this socket is not listening, gets closed, or
no complete connection becomes avaialble.
java.lang.InterruptedException - if the call to wait gets interrupted.public void close()
public java.lang.String toString()
public void plugoutNotification(int id,
java.lang.Object replacement,
java.lang.Object[] args)
plugoutNotification in interface PlugoutListenerid - The id passed to registerPlugoutNotificationreplacement - the object that will be replacing the object that
is being plugged out. It will be null if the object is getting plugged out,
rather then being replaced with a new plugin.args - were the args passed to registerPlugoutNotificationpublic void finalize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||