| java.lang.Object seda.sandStorm.core.SimpleSink seda.sandStorm.lib.aSocket.ATcpConnection
ATcpConnection | public class ATcpConnection extends SimpleSink implements QueueElementIF(Code) | | An ATcpConnection represents an established connection on an asynchronous
socket. It is used to send outgoing packets over the connection, and
to initiate packet reads from the connection. When a packet arrives on
this connection, an ATcpInPacket object will be pushed to the SinkIF
specified by the startReader() call. The ATcpInPacket will contain a
pointer to this ATcpConnection. This object also allows the connection
to be flushed or closed.
author: Matt Welsh See Also: ATcpInPacket |
Field Summary | |
public SockState | sockState | public Object | userTag The application may use this field to associate some
application-specific state with this connection. |
userTag | public Object userTag(Code) | | The application may use this field to associate some
application-specific state with this connection. The aSocket
layer will not read or modify this field in any way.
|
ATcpConnection | protected ATcpConnection()(Code) | | |
close | public void close(SinkIF compQ) throws SinkClosedException(Code) | | Close the socket. A SinkClosedEvent will be posted on the given
compQ when the close is complete.
|
enqueue_lossy | public boolean enqueue_lossy(QueueElementIF buf)(Code) | | Enqueue an outgoing packet to be written to this socket.
Drops the packet if it cannot be enqueued.
|
flush | public void flush(SinkIF compQ) throws SinkClosedException(Code) | | Flush the socket. A SinkFlushedEvent will be posted on the given
compQ when the close is complete.
|
getClientSocket | public ATcpClientSocket getClientSocket()(Code) | | Return the ATcpClientSocket from which this connection came.
Returns null if this connection resulted from an ATcpServerSocket.
|
getPort | public int getPort()(Code) | | Return the port of the peer.
|
getSequenceNumber | public long getSequenceNumber()(Code) | | Returns the next sequence number for packets arriving on this
connection. Returns 0 if this connection is not active.
Note that this method may return an inaccurate sequence
number since the call is not synchronized with new message
arrivals that may increment the sequence number.
|
getServerSocket | public ATcpServerSocket getServerSocket()(Code) | | Return the ATcpServerSocket from which this connection came.
Returns null if this connection resulted from an ATcpClientSocket.
|
profileSize | public int profileSize()(Code) | | Returns the profile size of this connection.
|
size | public int size()(Code) | | Returns the number of elements currently waiting in the sink.
|
startReader | public void startReader(SinkIF receiveQ)(Code) | | Associate a SinkIF with this connection and allow data
to start flowing into it. When data is read, ATcpInPacket objects
will be pushed into the given SinkIF. If this sink is full,
the connection will attempt to allow packets to queue up in the O/S
network stack (i.e. by not issuing further read calls on the
socket). Until this method is called, no data will be read from
the socket.
|
startReader | public void startReader(SinkIF receiveQ, int readClogTries)(Code) | | Associate a SinkIF with this connection and allow data
to start flowing into it. When data is read, ATcpInPacket objects
will be pushed into the given SinkIF. If this queue is full,
the connection will attempt to allow packets to queue up in the O/S
network stack (i.e. by not issuing further read calls on the
socket). Until this method is called, no data will be read from
the socket.
Parameters: readClogTries - The number of times the aSocket layer willattempt to push a new entry onto the given SinkIF while theSinkIF is full. The queue entry will be dropped after this manytries. The default value is -1, which indicates that the aSocketlayer will attempt to push the queue entry indefinitely. |
|
|