|
Siena (v.1.5.5) API documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsiena.comm.UDPPacketReceiver
public class UDPPacketReceiver
receives packets through a UDP port.
Field Summary | |
---|---|
static int |
AcceptPollingInterval
controls the accept-close workaround. |
static int |
DefaultPort
|
static java.lang.String |
Schema
|
Constructor Summary | |
---|---|
UDPPacketReceiver(java.net.DatagramSocket s)
|
|
UDPPacketReceiver(int port_number)
create a receiver listening to the given UDP port. |
Method Summary | |
---|---|
byte[] |
address()
external address of this packet receiver. |
protected static java.net.InetAddress |
guessMyIPAddress()
|
protected static java.net.InetAddress |
guessMyIPAddress(java.net.DatagramSocket s)
|
protected static java.net.InetAddress |
guessMyIPAddress(java.net.ServerSocket s)
|
int |
receive(byte[] buf)
receives a packet in the given buffer. |
int |
receive(byte[] buf,
long timeout)
not yet implemented. |
void |
setHostName(java.lang.String hostname)
explicitly set the address of this packet receiver. |
void |
shutdown()
closes the receiver. |
byte[] |
uri()
Deprecated. since 1.4.0. Please use address() instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface siena.comm.PacketReceiver |
---|
address, uri |
Field Detail |
---|
public static final java.lang.String Schema
public static final int DefaultPort
public static int AcceptPollingInterval
TCPPacketReceiver.AcceptPollingInterval
for an
explanation of this parameter.
Constructor Detail |
---|
public UDPPacketReceiver(int port_number) throws java.io.IOException
port_number
- must be a valid UDP port number, or it can
be 0 in which case a random port is used
java.io.IOException
public UDPPacketReceiver(java.net.DatagramSocket s) throws java.net.UnknownHostException, java.io.IOException
java.net.UnknownHostException
java.io.IOException
Method Detail |
---|
public void setHostName(java.lang.String hostname)
public void shutdown()
PacketReceiver
shutdown
in interface PacketReceiver
public int receive(byte[] buf) throws PacketReceiverException
PacketReceiver
receive
in interface PacketReceiver
PacketReceiverException
- in case an error occurrs
while reading.public int receive(byte[] buf, long timeout)
receive
in interface PacketReceiver
public byte[] uri()
address()
instead.
address()
. The
reason for this change is more conceptual than practical: the
term "address" is more appropriate than the term "uri" because
it provides a way to reach a PacketReceiver
,
rather than an identifier.
public byte[] address()
:
host:
port
PacketReceiver.address()
protected static java.net.InetAddress guessMyIPAddress() throws java.net.UnknownHostException
java.net.UnknownHostException
protected static java.net.InetAddress guessMyIPAddress(java.net.ServerSocket s) throws java.net.UnknownHostException
java.net.UnknownHostException
protected static java.net.InetAddress guessMyIPAddress(java.net.DatagramSocket s) throws java.net.UnknownHostException
java.net.UnknownHostException
|
Siena (v.1.5.5) API documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |