net.i2p.sam

## Class SAMv3DatagramSession

- java.lang.Object
- - net.i2p.sam.SAMMessageSession
  - - net.i2p.sam.SAMDatagramSession
    - - net.i2p.sam.SAMv3DatagramSession

- All Implemented Interfaces:
    Closeable, AutoCloseable, SAMDatagramReceiver, SAMMessageSess, Session

      class SAMv3DatagramSession
      extends SAMDatagramSession
      implements Session, SAMDatagramReceiver

  SAM v3 datagram session implementation.

- - ### Field Summary

    - ### Fields inherited from class net.i2p.sam.SAMDatagramSession

      `DGRAM_SIZE_MAX, recv`

    - ### Fields inherited from class net.i2p.sam.SAMMessageSession

      `_isOwnSession, _log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SAMv3DatagramSession(String nick, Properties props, SAMv3Handler handler, I2PSession isess, int listenPort, SAMv3DatagramServer dgServer)` Build a Datagram Session on an existing i2p session registered with the given nickname Caller MUST call start().
    `SAMv3DatagramSession(String nick, SAMv3DatagramServer dgServer)` build a DatagramSession according to informations registered with the given nickname Caller MUST call start().

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getNick()`
    `void` | `receiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort)` Send a byte array to a SAM client.
    `void` | `stopDatagramReceiving()` Stop receiving data.

    - ### Methods inherited from class net.i2p.sam.SAMDatagramSession

      `messageReceived, sendBytes, sendBytes, shutDown`

    - ### Methods inherited from class net.i2p.sam.SAMMessageSession

      `close, getDestination, getI2PSession, getListenPort, getListenProtocol, sendBytesThroughMessageSession, sendBytesThroughMessageSession, start`

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

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

    - ### Methods inherited from interface net.i2p.sam.SAMMessageSess

      `close, getDestination, getListenPort, getListenProtocol, sendBytes, sendBytes, start`

- - ### Constructor Detail

    - #### SAMv3DatagramSession

          public SAMv3DatagramSession(String nick,
                                      Properties props,
                                      SAMv3Handler handler,
                                      I2PSession isess,
                                      int listenPort,
                                      SAMv3DatagramServer dgServer)
                               throws IOException,
                                      DataFormatException,
                                      I2PSessionException

      Build a Datagram Session on an existing i2p session registered with the given nickname Caller MUST call start().
      Parameters:
        `nick` - nickname of the session
      Throws:
        `IOException`
        `DataFormatException`
        `I2PSessionException`

    - #### SAMv3DatagramSession

          public SAMv3DatagramSession(String nick,
                                      SAMv3DatagramServer dgServer)
                               throws IOException,
                                      DataFormatException,
                                      I2PSessionException,
                                      SAMException

      build a DatagramSession according to informations registered with the given nickname Caller MUST call start().
      Parameters:
        `nick` - nickname of the session
      Throws:
        `IOException`
        `DataFormatException`
        `I2PSessionException`
        `SAMException`

  - ### Method Detail

    - #### getNick

          public String getNick()

      Specified by:
        `getNick` in interface `Session`

    - #### receiveDatagramBytes

          public void receiveDatagramBytes(Destination sender,
                                           byte[] data,
                                           int proto,
                                           int fromPort,
                                           int toPort)
                                    throws IOException

      Description copied from interface: `SAMDatagramReceiver`
      Send a byte array to a SAM client.
      Specified by:
        `receiveDatagramBytes` in interface `SAMDatagramReceiver`
      Parameters:
        `sender` - Destination
        `data` - Byte array to be received
        `proto` - I2CP protocol
        `fromPort` - I2CP from port
        `toPort` - I2CP to port
      Throws:
        `IOException`

    - #### stopDatagramReceiving

          public void stopDatagramReceiving()

      Description copied from interface: `SAMDatagramReceiver`
      Stop receiving data.
      Specified by:
        `stopDatagramReceiving` in interface `SAMDatagramReceiver`