net.i2p.router.transport.udp
Class UDPReceiver

java.lang.Object
  extended by net.i2p.router.transport.udp.UDPReceiver

public class UDPReceiver
extends java.lang.Object

Lowest level component to pull raw UDP datagrams off the wire as fast as possible, controlled by both the bandwidth limiter and the router's throttle. If the inbound queue gets too large or packets have been waiting around too long, they are dropped. Packets should be pulled off from the queue ASAP by a PacketHandler


Constructor Summary
UDPReceiver(RouterContext ctx, UDPTransport transport, java.net.DatagramSocket socket, java.lang.String name)
           
 
Method Summary
 UDPPacket receiveNext()
          Blocking call to retrieve the next inbound packet, or null if we have shut down.
 void shutdown()
           
 void startup()
           
 java.net.DatagramSocket updateListeningPort(java.net.DatagramSocket socket, int newPort)
          Replace the old listen port with the new one, returning the old.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPReceiver

public UDPReceiver(RouterContext ctx,
                   UDPTransport transport,
                   java.net.DatagramSocket socket,
                   java.lang.String name)
Method Detail

startup

public void startup()

shutdown

public void shutdown()

updateListeningPort

public java.net.DatagramSocket updateListeningPort(java.net.DatagramSocket socket,
                                                   int newPort)
Replace the old listen port with the new one, returning the old. NOTE: this closes the old socket so that blocking calls unblock!


receiveNext

public UDPPacket receiveNext()
Blocking call to retrieve the next inbound packet, or null if we have shut down.