|
|||||||||
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.AUdpSocket
public class 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 | |
---|---|
private boolean |
closed
|
SinkIF |
compQ
|
static int |
DEFAULT_MAX_PACKETSIZE
The default maximum packet size read by the socket. |
(package private) java.net.InetAddress |
localaddress
|
(package private) int |
localport
|
int |
maxPacketSize
|
private boolean |
readerstarted
|
(package private) java.net.InetAddress |
remaddress
|
(package private) int |
remport
|
(package private) DatagramSockState |
sockState
|
int |
writeClogThreshold
|
Constructor Summary | |
---|---|
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. |
java.net.DatagramSocket |
getSocket()
|
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 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, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_PACKETSIZE
public int maxPacketSize
public int writeClogThreshold
public SinkIF compQ
java.net.InetAddress localaddress
java.net.InetAddress remaddress
int localport
int remport
private boolean readerstarted
private boolean closed
DatagramSockState sockState
Constructor Detail |
---|
public AUdpSocket(SinkIF compQ) throws java.io.IOException
java.io.IOException
public AUdpSocket(int localport, SinkIF compQ) throws java.io.IOException
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.
java.io.IOException
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 interface SinkIF
enqueue
in class SimpleSink
packet
- 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 packet)
enqueue_lossy
in interface SinkIF
enqueue_lossy
in class SimpleSink
packet
- The QueueElementIF
to enqueue
public void enqueue_many(QueueElementIF[] packets) throws SinkException
enqueue_many
in interface SinkIF
enqueue_many
in class SimpleSink
packets
- 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 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()
public java.net.DatagramSocket getSocket()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |