Interface I2PSocketOptions

  • 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 Detail

      • PROP_BUFFER_SIZE

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

        static final String PROP_CONNECT_TIMEOUT
        How long wait for the ACK from a SYN, in milliseconds.
        See Also:
        Constant Field Values
      • PROFILE_BULK

        static final int PROFILE_BULK
        Since:
        0.9.66 promoted from ConnectionOptions
        See Also:
        Constant Field Values
      • PROFILE_INTERACTIVE

        static final int PROFILE_INTERACTIVE
        Since:
        0.9.66 promoted from ConnectionOptions
        See Also:
        Constant Field Values
    • Method Detail

      • getConnectTimeout

        long getConnectTimeout()
        How long we will wait for the ACK from a SYN, in milliseconds. Default 60 seconds. Max of 2 minutes enforced in Connection.java, and it also interprets <= 0 as default.
        Returns:
        milliseconds to wait, or -1 if we will wait indefinitely
      • setConnectTimeout

        void setConnectTimeout​(long ms)
        Define how long we will wait for the ACK from a SYN, in milliseconds. Default 60 seconds. Max of 2 minutes enforced in Connection.java, and it also interprets <= 0 as default.
        Parameters:
        ms - timeout in ms
      • 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 as of 0.9.36. Prior to that, the read() returned -1 or 0. 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 as of 0.9.36. Prior to that, the read() returned -1 or 0. 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 64 KB
        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 64 KB
        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)
        Since:
        0.8.9
      • setPort

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

        int getLocalPort()
        The local port.
        Returns:
        Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
        Since:
        0.8.9
      • 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
        Since:
        0.8.9