|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mdw.sandStorm.core.SimpleSink | +--mdw.sandStorm.lib.aSocket.AUdpSocket
An AUdpSocket implements an asynchronous datagram socket. Applications create an AUdpSocket and associate a SinkIF with it. Packets received on the socket will be pushed onto the SinkIF as AUdpInPacket objects. The AUdpSocket can also be used to send messages to the socket, and to associate a default send address using the connect() method.
AUdpInPacket
Field Summary | |
(package private) SinkIF |
compQ
|
static int |
DEFAULT_MAX_PACKETSIZE
The default maximum packet size read by the socket. |
(package private) NonblockingDatagramSocket |
dgsock
|
(package private) java.net.InetAddress |
localaddress
|
(package private) int |
localport
|
(package private) int |
maxPacketSize
|
(package private) java.net.InetAddress |
remaddress
|
(package private) int |
remport
|
(package private) DatagramSockState |
sockState
|
(package private) int |
writeClogThreshold
|
Constructor Summary | |
protected |
AUdpSocket()
Empty constructor needed by AMcastSocket, so the dgsock and sockState variables can be initialized correctly. |
|
AUdpSocket(java.net.InetAddress localaddr,
int localport,
SinkIF compQ,
int maxPacketSize,
int writeClogThreshold)
Create a socket bound to the given local address and local port. |
|
AUdpSocket(int localport,
SinkIF compQ)
Create a socket bound to the given local port. |
|
AUdpSocket(SinkIF compQ)
Create a socket bound to any available local port. |
Method Summary | |
void |
close(SinkIF compQ)
Close the socket. |
void |
connect(java.net.InetAddress addr,
int port)
Asynchronously connect this socket to the given port. |
void |
disconnect()
Asynchronously disconnect this socket from the given port. |
boolean |
enqueue_lossy(QueueElementIF packet)
Enqueue an outgoing packet to be written to this socket. |
void |
enqueue_many(QueueElementIF[] packets)
Enqueue an set of outgoing packets to this socket. |
void |
enqueue(QueueElementIF packet)
Enqueue an outgoing packet to be written to this socket. |
void |
flush(SinkIF compQ)
Flush the socket. |
java.net.InetAddress |
getAddress()
Return the InetAddress that this socket is connected to; returns null if not connected. |
java.net.InetAddress |
getLocalAddress()
Return the local InetAddress for this socket. |
int |
getLocalPort()
Return the local port for this socket. |
int |
getPort()
Return the port that this socket is connected to; returns -1 if not connected. |
long |
getSequenceNumber()
Returns the next sequence number for packets arriving on this socket. |
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 socket and allow data to start flowing into it. |
void |
startReader(SinkIF receiveQ,
int readClogTries)
Associate a SinkIF with this socket and allow data to start flowing into it. |
Methods inherited from class mdw.sandStorm.core.SimpleSink |
enqueue_abort, enqueue_commit, enqueue_prepare, getEnqueuePredicate, setEnqueuePredicate |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int DEFAULT_MAX_PACKETSIZE
int maxPacketSize
int writeClogThreshold
java.net.InetAddress localaddress
java.net.InetAddress remaddress
int localport
int remport
NonblockingDatagramSocket dgsock
SinkIF compQ
DatagramSockState sockState
Constructor Detail |
protected AUdpSocket()
public AUdpSocket(SinkIF compQ) throws java.io.IOException
public AUdpSocket(int localport, SinkIF compQ) throws java.io.IOException
public AUdpSocket(java.net.InetAddress localaddr, int localport, SinkIF compQ, int maxPacketSize, int writeClogThreshold) throws java.io.IOException
maxPacketSize
- The maximum size, in bytes, of packets that
this socket will attempt to receive. The default is
DEFAULT_MAX_PACKETSIZE, which is 16 KBytes.writeClogThreshold
- The maximum number of outstanding writes
on this socket before a SinkCloggedEvent is pushed to the
connection's completion queue. This is effectively the maximum depth
threshold for this connection's SinkIF. The default value is -1, which
indicates that no SinkCloggedEvents will be generated.Method Detail |
public void startReader(SinkIF receiveQ)
public void startReader(SinkIF receiveQ, int readClogTries)
readClogTries
- The number of times the aSocket layer will
attempt to push an incoming packet 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 packet) throws SinkException
enqueue
in class SimpleSink
mdw.sandStorm.api.SinkIF
element
- The QueueElementIF
to enqueueSinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.public boolean enqueue_lossy(QueueElementIF packet)
enqueue_lossy
in class SimpleSink
mdw.sandStorm.api.SinkIF
element
- The QueueElementIF
to enqueuepublic void enqueue_many(QueueElementIF[] packets) throws SinkException
enqueue_many
in class SimpleSink
mdw.sandStorm.api.SinkIF
elements
- The element array to enqueueSinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.public void close(SinkIF compQ) throws SinkClosedException
public void flush(SinkIF compQ) throws SinkClosedException
public int size()
size
in class SimpleSink
public long getSequenceNumber()
public int profileSize()
profileSize
in class SimpleSink
public void connect(java.net.InetAddress addr, int port)
public void disconnect()
public java.net.InetAddress getAddress()
public int getPort()
public java.net.InetAddress getLocalAddress()
public int getLocalPort()
|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |