## net.i2p.router.transport.udp
Class UDPEndpoint

    java.lang.Object
      net.i2p.router.transport.udp.UDPEndpoint

     class UDPEndpoint

extends Object

Coordinate the low level datagram socket, managing the UDPSender and UDPReceiver

Field Summary
`static String` `PROP_MAX_PORT`
`static String` `PROP_MIN_PORT` 8998 is monotone, and 32000 is the wrapper, so let's stay between those

Constructor Summary
`UDPEndpoint(RouterContext ctx, UDPTransport transport, int listenPort, InetAddress bindAddress)`

Method Summary
`int` `getListenPort()` call after startup() to get actual port or -1 on startup failure
`UDPSender` `getSender()`
`UDPPacket` `receive()` Blocking call to receive the next inbound UDP packet from any peer.
`int` `send(UDPPacket packet)` Add the packet to the outobund queue to be sent ASAP (as allowed by the bandwidth limiter)
`void` `setListenPort(int newPort)`
`void` `shutdown()`
`void` `startup()` caller should call getListenPort() after this to get the actual bound port and determine success

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROP_MIN_PORT

    public static final String PROP_MIN_PORT

  8998 is monotone, and 32000 is the wrapper, so let's stay between those

  See Also:
    Constant Field Values

### PROP_MAX_PORT

    public static final String PROP_MAX_PORT

See Also:
  Constant Field Values

Constructor Detail

### UDPEndpoint

    public UDPEndpoint(RouterContext ctx,
                       UDPTransport transport,
                       int listenPort,
                       InetAddress bindAddress)

Parameters:
  `listenPort` - -1 or the requested port, may not be honored
  `bindAddress` - null ok

Method Detail

### startup

    public void startup()

  caller should call getListenPort() after this to get the actual bound port and determine success

### shutdown

    public void shutdown()

### setListenPort

    public void setListenPort(int newPort)

### getListenPort

    public int getListenPort()

  call after startup() to get actual port or -1 on startup failure

### getSender

    public UDPSender getSender()

### send

    public int send(UDPPacket packet)

  Add the packet to the outobund queue to be sent ASAP (as allowed by the bandwidth limiter)

  Returns:
    number of packets in the send queue

### receive

    public UDPPacket receive()

  Blocking call to receive the next inbound UDP packet from any peer.