|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object seda.sandStorm.core.SimpleSink seda.sandStorm.lib.aSocket.ATcpConnection
public class ATcpConnection
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.
ATcpInPacket
Field Summary | |
---|---|
private java.net.InetAddress |
address
|
private ATcpClientSocket |
clientSocket
|
private boolean |
closed
|
private int |
port
|
private boolean |
readerstarted
|
private ATcpServerSocket |
serverSocket
|
SockState |
sockState
|
java.lang.Object |
userTag
The application may use this field to associate some application-specific state with this connection. |
Constructor Summary | |
---|---|
protected |
ATcpConnection()
|
|
ATcpConnection(ATcpClientSocket cliSock,
java.net.InetAddress address,
int port)
|
|
ATcpConnection(ATcpServerSocket servSock,
java.net.InetAddress address,
int port)
|
private |
ATcpConnection(java.net.InetAddress address,
int port)
|
Method Summary | |
---|---|
void |
close(SinkIF compQ)
Close the socket. |
boolean |
enqueue_lossy(QueueElementIF buf)
Enqueue an outgoing packet to be written to this socket. |
void |
enqueue_many(QueueElementIF[] bufarr)
Enqueue a set of outgoing packets to be written to this socket. |
void |
enqueue(QueueElementIF buf)
Enqueue an outgoing packet to be written to this socket. |
void |
flush(SinkIF compQ)
Flush the socket. |
java.net.InetAddress |
getAddress()
Return the address of the peer. |
ATcpClientSocket |
getClientSocket()
Return the ATcpClientSocket from which this connection came. |
int |
getPort()
Return the port of the peer. |
long |
getSequenceNumber()
Returns the next sequence number for packets arriving on this connection. |
ATcpServerSocket |
getServerSocket()
Return the ATcpServerSocket from which this connection came. |
int |
profileSize()
Returns the profile size of this connection. |
int |
size()
Returns the number of elements currently waiting in the sink. |
void |
startReader(SinkIF receiveQ)
Associate a SinkIF with this connection and allow data to start flowing into it. |
void |
startReader(SinkIF receiveQ,
int readClogTries)
Associate a SinkIF with this connection and allow data to start flowing into it. |
java.lang.String |
toString()
|
Methods inherited from class seda.sandStorm.core.SimpleSink |
---|
enqueue_abort, enqueue_commit, enqueue_prepare, getEnqueuePredicate, setEnqueuePredicate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.net.InetAddress address
private int port
private boolean closed
private boolean readerstarted
private ATcpClientSocket clientSocket
private ATcpServerSocket serverSocket
public SockState sockState
public java.lang.Object userTag
Constructor Detail |
---|
private ATcpConnection(java.net.InetAddress address, int port)
public ATcpConnection(ATcpClientSocket cliSock, java.net.InetAddress address, int port)
public ATcpConnection(ATcpServerSocket servSock, java.net.InetAddress address, int port)
protected ATcpConnection()
Method Detail |
---|
public java.net.InetAddress getAddress()
public int getPort()
public ATcpServerSocket getServerSocket()
public ATcpClientSocket getClientSocket()
public void startReader(SinkIF receiveQ)
public void startReader(SinkIF receiveQ, int readClogTries)
readClogTries
- The number of times the aSocket layer will
attempt to push a new entry onto the given SinkIF while the
SinkIF is full. The queue entry will be dropped after this many
tries. The default value is -1, which indicates that the aSocket
layer will attempt to push the queue entry indefinitely.public void enqueue(QueueElementIF buf) throws SinkException
enqueue
in interface SinkIF
enqueue
in class SimpleSink
buf
- The QueueElementIF
to enqueue
SinkFullException
- Indicates that the sink is temporarily full.
SinkClosedException
- Indicates that the sink is
no longer being serviced.
SinkException
public boolean enqueue_lossy(QueueElementIF buf)
enqueue_lossy
in interface SinkIF
enqueue_lossy
in class SimpleSink
buf
- The QueueElementIF
to enqueue
public void enqueue_many(QueueElementIF[] bufarr) throws SinkException
enqueue_many
in interface SinkIF
enqueue_many
in class SimpleSink
bufarr
- The element array to enqueue
SinkFullException
- Indicates that the sink is temporarily full.
SinkClosedException
- Indicates that the sink is
no longer being serviced.
SinkException
public void close(SinkIF compQ) throws SinkClosedException
SinkClosedException
public void flush(SinkIF compQ) throws SinkClosedException
SinkClosedException
public int size()
size
in interface SinkIF
size
in class SimpleSink
public long getSequenceNumber()
public int profileSize()
profileSize
in interface ProfilableIF
profileSize
in class SimpleSink
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |