## net.i2p.client.streaming
Class ConnectionOptions

    java.lang.Object
      net.i2p.client.streaming.I2PSocketOptionsImpl
          net.i2p.client.streaming.ConnectionOptions

All Implemented Interfaces:
  I2PSocketOptions

public class ConnectionOptions
extends I2PSocketOptionsImpl

Define the current options for the con (and allow custom tweaking midstream)

Field Summary
`static int` `DEFAULT_BUFFER_SIZE`
`static int` `DEFAULT_CONNECT_TIMEOUT`
`(package private) static int` `DEFAULT_MAX_SENDS`
`static int` `DEFAULT_WRITE_TIMEOUT`
`static int` `INACTIVITY_ACTION_DISCONNECT` on inactivity timeout, close the connection
`static int` `INACTIVITY_ACTION_NOOP` on inactivity timeout, do nothing
`static int` `INACTIVITY_ACTION_SEND` on inactivity timeout, send a payload message
`(package private) static int` `INITIAL_WINDOW_SIZE`
`(package private) static int` `MIN_WINDOW_SIZE`
`static int` `PROFILE_BULK`
`static int` `PROFILE_INTERACTIVE`
`static java.lang.String` `PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR`
`static java.lang.String` `PROP_CONNECT_DELAY`
`static java.lang.String` `PROP_INACTIVITY_ACTION`
`static java.lang.String` `PROP_INACTIVITY_TIMEOUT`
`static java.lang.String` `PROP_INITIAL_ACK_DELAY`
`static java.lang.String` `PROP_INITIAL_RECEIVE_WINDOW`
`static java.lang.String` `PROP_INITIAL_RESEND_DELAY`
`static java.lang.String` `PROP_INITIAL_RTT`
`static java.lang.String` `PROP_INITIAL_WINDOW_SIZE`
`static java.lang.String` `PROP_MAX_MESSAGE_SIZE`
`static java.lang.String` `PROP_MAX_RESENDS`
`static java.lang.String` `PROP_MAX_WINDOW_SIZE`
`static java.lang.String` `PROP_PROFILE`
`static java.lang.String` `PROP_SLOW_START_GROWTH_RATE_FACTOR`

Fields inherited from interface net.i2p.client.streaming.I2PSocketOptions
`PROP_BUFFER_SIZE, PROP_CONNECT_TIMEOUT, PROP_READ_TIMEOUT, PROP_WRITE_TIMEOUT`

Constructor Summary
`ConnectionOptions()`
`ConnectionOptions(ConnectionOptions opts)`
`ConnectionOptions(I2PSocketOptions opts)`
`ConnectionOptions(java.util.Properties opts)`

Method Summary
`int` `getChoke()` how long we want to wait before any data is transferred on the connection in either direction
`int` `getCongestionAvoidanceGrowthRateFactor()` When we're in congestion avoidance, we grow the window size at the rate of 1/(windowSize*factor).
`int` `getConnectDelay()` how long will we wait after instantiating a new con before actually attempting to connect.
`long` `getConnectTimeout()` How long we will wait for the ACK from a SYN, in milliseconds.
`int` `getInactivityAction()`
`int` `getInactivityTimeout()` What period of inactivity qualifies as "too long"?
`int` `getInboundBufferSize()` how much data are we willing to accept in our buffer?
`protected int` `getInt(java.util.Properties opts, java.lang.String name, int defaultVal)`
`int` `getMaxBufferSize()` How much data will we accept that hasn't been written out yet.
`int` `getMaxMessageSize()` What is the largest message we want to send or receive?
`int` `getMaxResends()` How many times will we try to send a message before giving up?
`int` `getMaxWindowSize()`
`int` `getProfile()` What profile do we want to use for this connection?
`long` `getReadTimeout()` What is the longest we'll block on the input stream while waiting for more data.
`int` `getReceiveWindow()` after how many consecutive messages should we ack?
`boolean` `getRequireFullySigned()` Do we want all packets in both directions to be signed, or can we deal with signatures on the SYN and FIN packets only?
`int` `getResendDelay()` How long after sending a packet will we wait before resending?
`int` `getRTO()`
`int` `getRTT()` What to set the round trip time estimate to (in milliseconds)
`int` `getRTTTrend()` If we have 3 consecutive rtt increases, we are trending upwards (1), or if we have 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.
`int` `getSendAckDelay()` if there are packets we haven't ACKed yet and we don't receive _receiveWindow messages before (_lastSendTime+_sendAckDelay), send an ACK of what we have received so far.
`int` `getSlowStartGrowthRateFactor()` When we're in slow start, we grow the window size at the rate of 1/(factor).
`int` `getWindowSize()` How many messages will we send before waiting for an ACK?
`long` `getWriteTimeout()` What is the longest we'll block on the output stream while waiting for the data to flush.
`protected void` `init(java.util.Properties opts)`
`static void` `main(java.lang.String[] args)`
`void` `setChoke(int ms)`
`void` `setCongestionAvoidanceGrowthRateFactor(int factor)`
`void` `setConnectDelay(int delayMs)`
`void` `setConnectTimeout(long ms)` Define how long we will wait for the ACK from a SYN, in milliseconds.
`void` `setInactivityAction(int action)`
`void` `setInactivityTimeout(int timeout)`
`void` `setInboundBufferSize(int bytes)`
`void` `setMaxBufferSize(int numBytes)` How much data will we accept that hasn't been written out yet.
`void` `setMaxMessageSize(int bytes)`
`void` `setMaxResends(int numSends)`
`void` `setMaxWindowSize(int msgs)`
`void` `setProfile(int profile)`
`void` `setProperties(java.util.Properties opts)`
`void` `setReadTimeout(long ms)` What is the longest we'll block on the input stream while waiting for more data.
`void` `setReceiveWindow(int numMsgs)`
`void` `setRequireFullySigned(boolean sign)`
`void` `setResendDelay(int ms)`
`void` `setRTT(int ms)`
`void` `setSendAckDelay(int delayMs)`
`void` `setSlowStartGrowthRateFactor(int factor)`
`void` `setWindowSize(int numMsgs)`
`void` `setWriteTimeout(long ms)` What is the longest we'll block on the output stream while waiting for the data to flush.
`java.lang.String` `toString()`
`void` `updateRTT(int measuredValue)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### PROFILE_BULK

    public static final int PROFILE_BULK

See Also:
  Constant Field Values

### PROFILE_INTERACTIVE

    public static final int PROFILE_INTERACTIVE

See Also:
  Constant Field Values

### INACTIVITY_ACTION_NOOP

    public static final int INACTIVITY_ACTION_NOOP

  on inactivity timeout, do nothing

  See Also:
    Constant Field Values

### INACTIVITY_ACTION_DISCONNECT

    public static final int INACTIVITY_ACTION_DISCONNECT

  on inactivity timeout, close the connection

  See Also:
    Constant Field Values

### INACTIVITY_ACTION_SEND

    public static final int INACTIVITY_ACTION_SEND

  on inactivity timeout, send a payload message

  See Also:
    Constant Field Values

### PROP_CONNECT_DELAY

    public static final java.lang.String PROP_CONNECT_DELAY

See Also:
  Constant Field Values

### PROP_PROFILE

    public static final java.lang.String PROP_PROFILE

See Also:
  Constant Field Values

### PROP_MAX_MESSAGE_SIZE

    public static final java.lang.String PROP_MAX_MESSAGE_SIZE

See Also:
  Constant Field Values

### PROP_MAX_RESENDS

    public static final java.lang.String PROP_MAX_RESENDS

See Also:
  Constant Field Values

### PROP_INITIAL_RTT

    public static final java.lang.String PROP_INITIAL_RTT

See Also:
  Constant Field Values

### PROP_INITIAL_RESEND_DELAY

    public static final java.lang.String PROP_INITIAL_RESEND_DELAY

See Also:
  Constant Field Values

### PROP_INITIAL_ACK_DELAY

    public static final java.lang.String PROP_INITIAL_ACK_DELAY

See Also:
  Constant Field Values

### PROP_INITIAL_WINDOW_SIZE

    public static final java.lang.String PROP_INITIAL_WINDOW_SIZE

See Also:
  Constant Field Values

### PROP_INITIAL_RECEIVE_WINDOW

    public static final java.lang.String PROP_INITIAL_RECEIVE_WINDOW

See Also:
  Constant Field Values

### PROP_INACTIVITY_TIMEOUT

    public static final java.lang.String PROP_INACTIVITY_TIMEOUT

See Also:
  Constant Field Values

### PROP_INACTIVITY_ACTION

    public static final java.lang.String PROP_INACTIVITY_ACTION

See Also:
  Constant Field Values

### PROP_MAX_WINDOW_SIZE

    public static final java.lang.String PROP_MAX_WINDOW_SIZE

See Also:
  Constant Field Values

### PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR

    public static final java.lang.String PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR

See Also:
  Constant Field Values

### PROP_SLOW_START_GROWTH_RATE_FACTOR

    public static final java.lang.String PROP_SLOW_START_GROWTH_RATE_FACTOR

See Also:
  Constant Field Values

### INITIAL_WINDOW_SIZE

    static final int INITIAL_WINDOW_SIZE

See Also:
  Constant Field Values

### DEFAULT_MAX_SENDS

    static final int DEFAULT_MAX_SENDS

See Also:
  Constant Field Values

### MIN_WINDOW_SIZE

    static final int MIN_WINDOW_SIZE

See Also:
  Constant Field Values

### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

### DEFAULT_WRITE_TIMEOUT

    public static final int DEFAULT_WRITE_TIMEOUT

See Also:
  Constant Field Values

### DEFAULT_CONNECT_TIMEOUT

    public static final int DEFAULT_CONNECT_TIMEOUT

See Also:
  Constant Field Values

Constructor Detail

### ConnectionOptions

    public ConnectionOptions()

### ConnectionOptions

    public ConnectionOptions(java.util.Properties opts)

### ConnectionOptions

    public ConnectionOptions(I2PSocketOptions opts)

### ConnectionOptions

    public ConnectionOptions(ConnectionOptions opts)

Method Detail

### init

    protected void init(java.util.Properties opts)

  Overrides:
    `init` in class `I2PSocketOptionsImpl`

### setProperties

    public void setProperties(java.util.Properties opts)

  Overrides:
    `setProperties` in class `I2PSocketOptionsImpl`

### getConnectDelay

    public int getConnectDelay()

  how long will we wait after instantiating a new con before actually attempting to connect. If this is set to 0, connect ASAP. If it is greater than 0, wait until the output stream is flushed, the buffer fills, or that many milliseconds pass.

### setConnectDelay

    public void setConnectDelay(int delayMs)

### getRequireFullySigned

    public boolean getRequireFullySigned()

  Do we want all packets in both directions to be signed, or can we deal with signatures on the SYN and FIN packets only?

### setRequireFullySigned

    public void setRequireFullySigned(boolean sign)

### getWindowSize

    public int getWindowSize()

  How many messages will we send before waiting for an ACK?

### setWindowSize

    public void setWindowSize(int numMsgs)

### getReceiveWindow

    public int getReceiveWindow()

  after how many consecutive messages should we ack?

### setReceiveWindow

    public void setReceiveWindow(int numMsgs)

### getRTT

    public int getRTT()

  What to set the round trip time estimate to (in milliseconds)

### setRTT

    public void setRTT(int ms)

### getRTO

    public int getRTO()

### getRTTTrend

    public int getRTTTrend()

  If we have 3 consecutive rtt increases, we are trending upwards (1), or if we have 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.

### updateRTT

    public void updateRTT(int measuredValue)

### getResendDelay

    public int getResendDelay()

  How long after sending a packet will we wait before resending?

### setResendDelay

    public void setResendDelay(int ms)

### getSendAckDelay

    public int getSendAckDelay()

  if there are packets we haven't ACKed yet and we don't receive _receiveWindow messages before (_lastSendTime+_sendAckDelay), send an ACK of what we have received so far.

### setSendAckDelay

    public void setSendAckDelay(int delayMs)

### getMaxMessageSize

    public int getMaxMessageSize()

  What is the largest message we want to send or receive?

### setMaxMessageSize

    public void setMaxMessageSize(int bytes)

### getChoke

    public int getChoke()

  how long we want to wait before any data is transferred on the connection in either direction

### setChoke

    public void setChoke(int ms)

### getProfile

    public int getProfile()

  What profile do we want to use for this connection?

### setProfile

    public void setProfile(int profile)

### getMaxResends

    public int getMaxResends()

  How many times will we try to send a message before giving up?

### setMaxResends

    public void setMaxResends(int numSends)

### getInactivityTimeout

    public int getInactivityTimeout()

  What period of inactivity qualifies as "too long"?

### setInactivityTimeout

    public void setInactivityTimeout(int timeout)

### getInactivityAction

    public int getInactivityAction()

### setInactivityAction

    public void setInactivityAction(int action)

### getMaxWindowSize

    public int getMaxWindowSize()

### setMaxWindowSize

    public void setMaxWindowSize(int msgs)

### getInboundBufferSize

    public int getInboundBufferSize()

  how much data are we willing to accept in our buffer?

### setInboundBufferSize

    public void setInboundBufferSize(int bytes)

### getCongestionAvoidanceGrowthRateFactor

    public int getCongestionAvoidanceGrowthRateFactor()

  When we're in congestion avoidance, we grow the window size at the rate of 1/(windowSize*factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.

### setCongestionAvoidanceGrowthRateFactor

    public void setCongestionAvoidanceGrowthRateFactor(int factor)

### getSlowStartGrowthRateFactor

    public int getSlowStartGrowthRateFactor()

  When we're in slow start, we grow the window size at the rate of 1/(factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.

### setSlowStartGrowthRateFactor

    public void setSlowStartGrowthRateFactor(int factor)

### toString

    public java.lang.String toString()

### main

    public static void main(java.lang.String[] args)

### getInt

    protected int getInt(java.util.Properties opts,
                         java.lang.String name,
                         int defaultVal)

### getConnectTimeout

    public long getConnectTimeout()

  How long we will wait for the ACK from a SYN, in milliseconds.

  Specified by:
    `getConnectTimeout` in interface `I2PSocketOptions`
  Returns:
    milliseconds to wait, or -1 if we will wait indefinitely

### setConnectTimeout

    public void setConnectTimeout(long ms)

  Define how long we will wait for the ACK from a SYN, in milliseconds.

  Specified by:
    `setConnectTimeout` in interface `I2PSocketOptions`

### getReadTimeout

    public 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 InterruptedIOException

  Specified by:
    `getReadTimeout` in interface `I2PSocketOptions`

### setReadTimeout

    public 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 InterruptedIOException

  Specified by:
    `setReadTimeout` in interface `I2PSocketOptions`

### getMaxBufferSize

    public 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)

  Specified by:
    `getMaxBufferSize` in interface `I2PSocketOptions`
  Returns:
    buffer size limit, in bytes

### setMaxBufferSize

    public 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)

  Specified by:
    `setMaxBufferSize` in interface `I2PSocketOptions`

### getWriteTimeout

    public 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.

  Specified by:
    `getWriteTimeout` in interface `I2PSocketOptions`

### setWriteTimeout

    public 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.

  Specified by:
    `setWriteTimeout` in interface `I2PSocketOptions`