net.i2p.i2ptunnel.socks

## Class SOCKSUDPPort

- java.lang.Object
- - net.i2p.i2ptunnel.socks.SOCKSUDPPort

- All Implemented Interfaces:
    Sink, Source

      public class SOCKSUDPPort
      extends Object
      implements Source, Sink

  Implements a UDP port and Socks encapsulation / decapsulation. This is for a single port. If there is demuxing for multiple ports, it happens outside of here. TX: UDPSource -> SOCKSUDPUnwrapper -> (I2PSink in SOCKSUDPTunnel) RX: UDPSink <- SOCKSUDPWrapper ( <- MultiSink <- I2PSource in SOCKSUDPTunnel) The Unwrapper passes headers to the Wrapper through a cache. MultiSink routes packets based on toPort.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SOCKSUDPPort(InetAddress host, int port, Map<Integer,SOCKSUDPPort> replyMap)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getPort()` Returns the UDP port number that this port is listening on.
    `void` | `send(Destination from, int fromPort, int toPort, byte[] data)` May throw RuntimeException from underlying sink
    `void` | `setSink(Sink sink)` Sets the sink for incoming UDP datagrams from I2P.
    `void` | `start()` Starts the UDP source to begin receiving datagrams.
    `void` | `stop()` Stops the UDP source and sink, closing the underlying sockets.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SOCKSUDPPort

          public SOCKSUDPPort(InetAddress host,
                              int port,
                              Map<Integer,SOCKSUDPPort> replyMap)

  - ### Method Detail

    - #### getPort

          public int getPort()

      Returns the UDP port number that this port is listening on.
      Returns:
        the local UDP port number

    - #### send

          public void send(Destination from,
                           int fromPort,
                           int toPort,
                           byte[] data)

      May throw RuntimeException from underlying sink
      Specified by:
        `send` in interface `Sink`
      Parameters:
        `from` - will be passed along
        `fromPort` - will be passed along
        `toPort` - will be passed along
      Throws:
        `RuntimeException`

    - #### setSink

          public void setSink(Sink sink)

      Sets the sink for incoming UDP datagrams from I2P.
      Specified by:
        `setSink` in interface `Source`
      Parameters:
        `sink` - the sink to receive processed UDP datagrams

    - #### start

          public void start()

      Starts the UDP source to begin receiving datagrams.
      Specified by:
        `start` in interface `Source`

    - #### stop

          public void stop()

      Stops the UDP source and sink, closing the underlying sockets.