SocketListener
class UDPEndpoint extends java.lang.Object implements SocketListener
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static java.lang.String |
PROP_MAX_PORT |
|
static java.lang.String |
PROP_MIN_PORT |
8998 is monotone, and 31000 is the wrapper outbound, so let's stay between those
|
コンストラクタ | 説明 |
---|---|
UDPEndpoint(RouterContext ctx,
UDPTransport transport,
int listenPort,
java.net.InetAddress bindAddress) |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
clearOutbound() |
Clear outbound queue, probably in preparation for sending destroy() to everybody.
|
void |
fail() |
|
int |
getListenPort() |
call after startup() to get actual port or -1 on startup failure
|
UDPSender |
getSender() |
|
boolean |
isIPv4() |
|
boolean |
isIPv6() |
|
UDPPacket |
receive() |
Blocking call to receive the next inbound UDP packet from any peer.
|
static int |
selectRandomPort(RouterContext ctx) |
Pick a random port between the configured boundaries
|
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) |
|
void |
shutdown() |
|
void |
startup() |
Caller should call getListenPort() after this to get the actual bound port and determine success .
|
java.lang.String |
toString() |
public static final java.lang.String PROP_MIN_PORT
public static final java.lang.String PROP_MAX_PORT
public UDPEndpoint(RouterContext ctx, UDPTransport transport, int listenPort, java.net.InetAddress bindAddress)
transport
- may be null for unit testing ONLYlistenPort
- -1 or the requested port, may not be honoredbindAddress
- null okpublic void startup() throws java.net.SocketException
java.net.SocketException
public void shutdown()
public void setListenPort(int newPort)
public static int selectRandomPort(RouterContext ctx)
public int getListenPort()
public UDPSender getSender()
public void send(UDPPacket packet)
public UDPPacket receive()
public void clearOutbound()
public boolean isIPv4()
public boolean isIPv6()
public void fail()
fail
インタフェース内 SocketListener
public java.lang.String toString()
toString
クラス内 java.lang.Object