net.i2p.i2ptunnel.socks

## Class SOCKSHeader

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

-     public class SOCKSHeader
      extends Object

  Save the SOCKS header from a datagram Ref: RFC 1928

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SOCKSHeader(byte[] data)`
    `SOCKSHeader(Destination dest, int port)` Make a dummy header from a dest, for those cases where we want to receive unsolicited datagrams.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBytes()`
    `Destination` | `getDestination()`
    `String` | `getHost()` As of 0.9.53, returns IP address as a string for address types 1 and 4.
    `int` | `getPort()`

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

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

- - ### Constructor Detail

    - #### SOCKSHeader

          public SOCKSHeader(byte[] data)

      Parameters:
        `data` - the whole packet
      Throws:
        `IllegalArgumentException` - on bad socks format

    - #### SOCKSHeader

          public SOCKSHeader(Destination dest,
                             int port)

      Make a dummy header from a dest, for those cases where we want to receive unsolicited datagrams. Unused for now.
      Parameters:
        `port` - I2CP port 0-65535

  - ### Method Detail

    - #### getBytes

          public byte[] getBytes()

    - #### getDestination

          public Destination getDestination()

      Returns:
        destination or null

    - #### getHost

          public String getHost()

      As of 0.9.53, returns IP address as a string for address types 1 and 4.
      Returns:
        hostname or null for unknown address type

    - #### getPort

          public int getPort()

      Returns:
        0 - 65535