Class UDPSink

java.lang.Object
net.i2p.i2ptunnel.udp.UDPSink
All Implemented Interfaces:
Sink

public class UDPSink extends Object implements Sink
Author:
welterde
  • Field Details

    • sock

      protected final DatagramSocket sock
    • remoteHost

      protected final InetAddress remoteHost
    • remotePort

      protected final int remotePort
  • Constructor Details

    • UDPSink

      public UDPSink(InetAddress host, int port)
      Parameters:
      host - where to send
      port - where to send
      Throws:
      IllegalArgumentException - on DatagramSocket IOException
    • UDPSink

      public UDPSink(DatagramSocket socket, InetAddress host, int port)
      Parameters:
      socket - existing socket
      host - where to send
      port - where to send
      Since:
      0.9.53
  • Method Details

    • send

      public void send(Destination src, int fromPort, int toPort, byte[] data)
      Specified by:
      send in interface Sink
      Parameters:
      src - ignored
      fromPort - ignored
      toPort - ignored
      Throws:
      RuntimeException - on DatagramSocket IOException
      Since:
      0.9.53 added fromPort and toPort parameters, breaking change, sorry
    • getPort

      public int getPort()
      Returns:
      the local port of the DatagramSocket we are sending from
    • getSocket

      public DatagramSocket getSocket()
      to pass to UDPSource constructor
    • stop

      public void stop()