|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.clackrouter.application.UDPSocket
public class UDPSocket
A socket implementing the UDP protocol for a Clack application.
Unlike a TCPSocket, a UDPSocket is not a ClackComponent and
simple receives datagrams via the addDatagramToQueue(VNSUDPPacket) method
and sends datagrams by directly accessing the UDP component.
| Nested Class Summary | |
|---|---|
static class |
UDPSocket.HostInfo
Simple structure to tell the source address and port of a received datagram |
| Constructor Summary | |
|---|---|
UDPSocket(java.lang.String name,
UDP parent)
|
|
| Method Summary | |
|---|---|
void |
addDatagramToQueue(VNSUDPPacket packet)
|
void |
bind()
Default bind behavior selects a random port in the range between 1024 and 2024 and binds to the first listed interface on the router (often eth0) |
void |
bind(java.net.InetAddress local_address,
int local_port)
Binds the socket to a specified address and port. |
java.lang.String |
getName()
the socket's name |
java.nio.ByteBuffer |
recvFrom(long msec_timeout,
UDPSocket.HostInfo info)
Receive a UDP datagram |
void |
sendTo(java.nio.ByteBuffer buf,
UDPSocket.HostInfo info)
Send a datagram to the specified address and port |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UDPSocket(java.lang.String name,
UDP parent)
| Method Detail |
|---|
public void addDatagramToQueue(VNSUDPPacket packet)
public void sendTo(java.nio.ByteBuffer buf,
UDPSocket.HostInfo info)
buf - data to be sentinfo - destination address and port information
public void bind()
throws java.lang.Exception
java.lang.Exception
public void bind(java.net.InetAddress local_address,
int local_port)
throws java.lang.Exception
At this time, no restrictions are placed on what addresses or ports may be bound to.
local_address - address to bind as sourcelocal_port - port to bind as source
java.lang.Exception
public java.nio.ByteBuffer recvFrom(long msec_timeout,
UDPSocket.HostInfo info)
msec_timeout - number of milliseconds before the call returnsinfo - upon return, contains information about datagram source address and port
public java.lang.String getName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||