class UDPEndpoint extends Object implements SocketListener
| Constructor and Description |
|---|
UDPEndpoint(RouterContext ctx,
UDPTransport transport,
int listenPort,
InetAddress bindAddress) |
| Modifier and Type | Method and Description |
|---|---|
void | clearOutbound()Clear outbound queue, probably in preparation for sending destroy() to everybody. |
void | fail()Notification that the socket failed. |
int | getListenPort()Call after startup() to get the actual port, or -1 on startup failure. |
UDPSender | getSender()The UDP sender. |
boolean | isIPv4() |
boolean | isIPv6() |
UDPPacket | receive()Blocking call to receive the next inbound UDP packet from any peer. |
void | send(UDPPacket packet)Add the packet to the outobund queue to be sent ASAP (as allowed by
the bandwidth limiter)
BLOCKING if queue is full. |
void | setListenPort(int newPort)The listen port for the next socket bind. |
void | shutdown()Shut down the sender, receiver, and socket. |
void | startup()Caller should call getListenPort() after this to get the actual bound port and determine success . |
String | toString() |
public UDPEndpoint(RouterContext ctx, UDPTransport transport, int listenPort, InetAddress bindAddress)
transport - may be null for unit testing ONLYlistenPort - -1 or the requested port, may not be honoredbindAddress - null okpublic void clearOutbound()
public void fail()
SocketListenerfail in interface SocketListenerpublic int getListenPort()
public UDPSender getSender()
public boolean isIPv4()
public boolean isIPv6()
public UDPPacket receive()
public void send(UDPPacket packet)
public void setListenPort(int newPort)
public void shutdown()
public void startup()
throws SocketExceptionSocketException