java.lang.Object
org.klomp.snark.dht.DatagramSender

public final class DatagramSenderextends Object
Shared low-level datagram send path for the DHT and UDP tracker clients. Wraps the session send call with the common protocol selection (repliable datagrams on PROTO_DATAGRAM vs raw datagrams on PROTO_DATAGRAM_RAW), so the two transports cannot drift apart on port/protocol pairing.
  • Constructor Details

    • DatagramSender

      private DatagramSender()
      Utility class, not intended for instantiation.
  • Method Details

    • send

      public static boolean send(I2PSession session, SendMessageOptions opts, Destination dest, byte[] payload, int fromPort, int toPort, boolean repliable) throws I2PSessionException
      Send a pre-wrapped datagram payload through the session.
      Parameters:
      session - the session to send through
      opts - the send options (date, lease set, crypto tags)
      dest - the destination to send to
      payload - the wrapped datagram payload, sent in full
      fromPort - the port to send from
      toPort - the port to send to
      repliable - true for a repliable datagram (PROTO_DATAGRAM), false for raw
      Returns:
      true if the session accepted the datagram for delivery
      Throws:
      I2PSessionException - on session failure