All Known Implementing Classes:
ConnectionOptions, I2PSocketOptionsImpl

public interface I2PSocketOptions
Define the configuration for streaming and verifying data on the socket. Use I2PSocketManager.buildOptions() to get one of these.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Profile for bulk transfers (normal downloads/uploads).
    static final int
    Profile for interactive traffic (latency-sensitive, e.g.
    static final String
    How much data will we accept that hasn't been written out yet.
    static final String
    Base time to wait for the ACK from a SYN, in milliseconds, before any adaptive scaling is applied.
    static final String
    Absolute cap on the time an outbound connect will wait for a SYN ACK, in milliseconds.
    static final String
    If set, the profile used to prioritize packets on the network.
    static final String
    How long to block on read.
    static final String
    How long to block on write/flush.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    long
    Base time to wait for the ACK from a SYN, in milliseconds.
    int
    The local port.
    int
    How much data will we accept that hasn't been written out yet.
    int
    The remote port.
    long
    What is the longest we'll block on the input stream while waiting for more data.
    long
    What is the longest we'll block on the output stream while waiting for the data to flush.
    void
    Define how long we will wait for the ACK from a SYN, in milliseconds.
    void
    setLocalPort(int port)
    The local port.
    void
    setMaxBufferSize(int numBytes)
    How much data will we accept that hasn't been written out yet.
    void
    setPort(int port)
    The remote port.
    void
    setReadTimeout(long ms)
    What is the longest we'll block on the input stream while waiting for more data.
    void
    setWriteTimeout(long ms)
    What is the longest we'll block on the output stream while waiting for the data to flush.
  • Field Details

    • PROP_BUFFER_SIZE

      static final String PROP_BUFFER_SIZE
      How much data will we accept that hasn't been written out yet.
      See Also:
    • PROP_CONNECT_TIMEOUT

      static final String PROP_CONNECT_TIMEOUT
      Base time to wait for the ACK from a SYN, in milliseconds, before any adaptive scaling is applied. Default 30 seconds; a value <= 0 turns the connect timeout off, so the handshake is not given up on a timer. The effective connect window adds the connect delay on the delayed-SYN path, is scaled by the router's connect timeout multiplier, and is capped by PROP_MAX_CONNECT_TIMEOUT.
      See Also:
    • PROP_MAX_CONNECT_TIMEOUT

      static final String PROP_MAX_CONNECT_TIMEOUT
      Absolute cap on the time an outbound connect will wait for a SYN ACK, in milliseconds. When set per-connection, overrides the router-wide i2p.streaming.maxConnectTimeout default; when absent, the global value applies.
      See Also:
    • PROP_READ_TIMEOUT

      static final String PROP_READ_TIMEOUT
      How long to block on read.
      See Also:
    • PROP_WRITE_TIMEOUT

      static final String PROP_WRITE_TIMEOUT
      How long to block on write/flush.
      See Also:
    • PROP_PROFILE

      static final String PROP_PROFILE
      If set, the profile used to prioritize packets on the network. One of the PROFILE_ constants below.
      See Also:
    • PROFILE_BULK

      static final int PROFILE_BULK
      Profile for bulk transfers (normal downloads/uploads).
      See Also:
    • PROFILE_INTERACTIVE

      static final int PROFILE_INTERACTIVE
      Profile for interactive traffic (latency-sensitive, e.g. SSH).
      See Also:
  • Method Details

    • getConnectTimeout

      long getConnectTimeout()
      Base time to wait for the ACK from a SYN, in milliseconds. This is the configured value only. The effective connect window adds the connect delay on the delayed-SYN path, is scaled by the router's connect timeout multiplier, and is capped at PROP_MAX_CONNECT_TIMEOUT (75 seconds by default), so a configured value above that cap waits no longer than the cap. Default 30 seconds.
      Returns:
      milliseconds to wait, or a non-positive value for no connect timeout, i.e. the handshake is not given up on a timer
    • setConnectTimeout

      void setConnectTimeout(long ms)
      Define how long we will wait for the ACK from a SYN, in milliseconds. The value is the base window only; see getConnectTimeout() for how the effective window is derived. Default 30 seconds.
      Parameters:
      ms - timeout in ms, <= 0 for no connect timeout
    • getReadTimeout

      long getReadTimeout()
      What is the longest we'll block on the input stream while waiting for more data. If this value is exceeded, the read() throws SocketTimeoutException. WARNING: Default -1 (unlimited), which is probably not what you want.
      Returns:
      timeout in ms, 0 for nonblocking, -1 for forever
    • setReadTimeout

      void setReadTimeout(long ms)
      What is the longest we'll block on the input stream while waiting for more data. If this value is exceeded, the read() throws SocketTimeoutException. WARNING: Default -1 (unlimited), which is probably not what you want.
      Parameters:
      ms - timeout in ms, 0 for nonblocking, -1 for forever
    • getMaxBufferSize

      int getMaxBufferSize()
      How much data will we accept that hasn't been written out yet. After this amount has been exceeded, subsequent .write calls will block until either some data is removed or the connection is closed. If this is less than or equal to zero, there is no limit (warning: can eat ram). Default is platform-dependent: 512 KB on a slow system or one with less than 512 MB of memory, otherwise 1 MB.
      Returns:
      buffer size limit, in bytes
    • setMaxBufferSize

      void setMaxBufferSize(int numBytes)
      How much data will we accept that hasn't been written out yet. After this amount has been exceeded, subsequent .write calls will block until either some data is removed or the connection is closed. If this is less than or equal to zero, there is no limit (warning: can eat ram). Default is platform-dependent: 512 KB on a slow system or one with less than 512 MB of memory, otherwise 1 MB.
      Parameters:
      numBytes - How much data will we accept that hasn't been written out yet.
    • getWriteTimeout

      long getWriteTimeout()
      What is the longest we'll block on the output stream while waiting for the data to flush. If this value is exceeded, the write() throws InterruptedIOException. If this is less than or equal to zero, there is no timeout. Default -1 (unlimited)
      Returns:
      wait time to block on the output stream while waiting for the data to flush.
    • setWriteTimeout

      void setWriteTimeout(long ms)
      What is the longest we'll block on the output stream while waiting for the data to flush. If this value is exceeded, the write() throws InterruptedIOException. If this is less than or equal to zero, there is no timeout. Default -1 (unlimited)
      Parameters:
      ms - wait time to block on the output stream while waiting for the data to flush.
    • getPort

      int getPort()
      The remote port.
      Returns:
      Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
    • setPort

      void setPort(int port)
      The remote port.
      Parameters:
      port - 0 - 65535
    • getLocalPort

      int getLocalPort()
      The local port.
      Returns:
      Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
    • setLocalPort

      void setLocalPort(int port)
      The local port. Zero (default) means you will receive traffic on all ports. Nonzero means you will get traffic ONLY for that port, use with care, as most applications do not specify a remote port.
      Parameters:
      port - 0 - 65535