Class TcpConfig


@Unstable public class TcpConfig extends TransportConfig
Author:
Julien Viet
  • Constructor Details

    • TcpConfig

      public TcpConfig()
    • TcpConfig

      public TcpConfig(TcpConfig other)
  • Method Details

    • copy

      protected TcpConfig copy()
      Specified by:
      copy in class TransportConfig
    • getSendBufferSize

      public int getSendBufferSize()
      Return the TCP send buffer size, in bytes.
      Returns:
      the send buffer size
    • setSendBufferSize

      public TcpConfig setSendBufferSize(int sendBufferSize)
      Set the TCP send buffer size
      Parameters:
      sendBufferSize - the buffers size, in bytes
      Returns:
      a reference to this, so the API can be used fluently
    • getReceiveBufferSize

      public int getReceiveBufferSize()
      Return the TCP receive buffer size, in bytes
      Returns:
      the receive buffer size
    • setReceiveBufferSize

      public TcpConfig setReceiveBufferSize(int receiveBufferSize)
      Set the TCP receive buffer size
      Parameters:
      receiveBufferSize - the buffers size, in bytes
      Returns:
      a reference to this, so the API can be used fluently
    • isReuseAddress

      public boolean isReuseAddress()
      Returns:
      the value of reuse address
    • setReuseAddress

      public TcpConfig setReuseAddress(boolean reuseAddress)
      Set the value of reuse address
      Parameters:
      reuseAddress - the value of reuse address
      Returns:
      a reference to this, so the API can be used fluently
    • getTrafficClass

      public int getTrafficClass()
      Returns:
      the value of traffic class
    • setTrafficClass

      public TcpConfig setTrafficClass(int trafficClass)
      Set the value of traffic class
      Parameters:
      trafficClass - the value of traffic class
      Returns:
      a reference to this, so the API can be used fluently
    • isSoReusePort

      public boolean isSoReusePort()
      Returns:
      the value of reuse address - only supported by native transports
    • setSoReusePort

      public TcpConfig setSoReusePort(boolean soReusePort)
      Set the value of reuse port.

      This is only supported by native transports.

      Parameters:
      soReusePort - the value of reuse port
      Returns:
      a reference to this, so the API can be used fluently
    • isSoKeepAlive

      public boolean isSoKeepAlive()
      Returns:
      is keep alive enabled?
    • setSoKeepAlive

      public TcpConfig setSoKeepAlive(boolean keepAlive)
      Set whether keep alive is enabled
      Parameters:
      keepAlive - true if keep alive is enabled
      Returns:
      a reference to this, so the API can be used fluently
    • getSoLinger

      public int getSoLinger()
      Returns:
      is SO_linger enabled
    • setSoLinger

      public TcpConfig setSoLinger(int soLinger)
      Set whether SO_linger keep alive is enabled
      Parameters:
      soLinger - true if SO_linger is enabled
      Returns:
      a reference to this, so the API can be used fluently
    • getOption

      public <T> T getOption(TcpOption<T> option)
      Returns a configurable TCP option.
      Parameters:
      option - the option to probe
      Returns:
      the option value or null when not set
    • setOption

      public <T> TcpConfig setOption(TcpOption<T> option, T value)
      Configure a TCP option.
      Parameters:
      option - the option to configure
      value - the value to set or null to unset
      Returns:
      a reference to this, so the API can be used fluently