Click or drag to resize
SocketOptions Class
Options to configure low-level socket options for the connections kept to the Cassandra hosts.
Inheritance Hierarchy
SystemObject
  CassandraSocketOptions

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 3.0.9 (git 5ca22bb)
Syntax
C#
public class SocketOptions

The SocketOptions type exposes the following members.

Constructors
  NameDescription
Public methodSocketOptions
Initializes a new instance of the SocketOptions class
Top
Methods
  NameDescription
Public methodSetConnectTimeoutMillis
Sets the number of milliseconds to wait for the socket to connect
Public methodSetDefunctReadTimeoutThreshold
Determines the amount of requests that simultaneously have to timeout before closing the connection.
Public methodSetKeepAlive
Sets if TCP keep-alive must be used
Public methodSetReadTimeoutMillis
Sets the per-host read timeout in milliseconds.

When setting this value, keep in mind the following:

- the timeout settings used on the Cassandra side (*_request_timeout_in_ms in cassandra.yaml) should be taken into account when picking a value for this read timeout. In particular, if this read timeout option is lower than Cassandra's timeout, the driver might assume that the host is not responsive and mark it down.

- the read timeout is only approximate and only control the timeout to one Cassandra host, not the full query (see ReadTimeoutMillis for more details).

Setting a value of 0 disables client read timeouts.
Public methodSetReceiveBufferSize
Sets the size of the buffer used by the socket to receive
Public methodSetReuseAddress
Public methodSetSendBufferSize
Sets the size of the buffer used by the socket to send
Public methodSetSoLinger
Sets the number of seconds to remain open after the Socket.Close() is called.
Public methodSetStreamMode
Sets if the driver should use either .NET NetworkStream (true) interface or SocketEventArgs interface (false, default) to handle the reading and writing
Public methodSetTcpNoDelay
Set a Boolean value that specifies whether the stream Socket is using the Nagle algorithm. Use false to enable Nagle algorithm; use true to disable Nagle algorithm (no delay). The default is true.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultConnectTimeoutMillis
Default value for ConnectTimeoutMillis, 5000ms.
Public fieldStatic memberDefaultReadTimeoutMillis
Default value for ReadTimeoutMillis, 12000ms.
Top
Properties
  NameDescription
Public propertyConnectTimeoutMillis
Gets the number of milliseconds to wait for the socket to connect
Public propertyDefunctReadTimeoutThreshold
Gets the amount of requests that simultaneously have to timeout before closing the connection.
Public propertyKeepAlive
Gets if TCP keep-alive must be used
Public propertyReadTimeoutMillis
The per-host read timeout in milliseconds.

This defines how long the driver will wait for a given Cassandra node to answer a query.

Please note that this is not the maximum time a call to Execute(String) may block; this is the maximum time that call will wait for one particular Cassandra host, but other hosts will be tried if one of them timeout. In other words, a Execute(String) call may theoretically wait up to ReadTimeoutMillis * {number_of_cassandra_hosts} (though the total number of hosts tried for a given query also depends on the LoadBalancingPolicy in use). Also note that for efficiency reasons, this read timeout is approximate, it may fire up to late. It is not meant to be used for precise timeout, but rather as a protection against misbehaving Cassandra nodes.
Public propertyReceiveBufferSize
Gets the size of the buffer used by the socket to receive
Public propertyReuseAddress
Public propertySendBufferSize
Gets the size of the buffer used by the socket to send
Public propertySoLinger
Gets the number of seconds to remain open after the Socket.Close() is called.
Public propertyTcpNoDelay
Gets a Boolean value that specifies whether the stream Socket is using the Nagle algorithm. When set to false, the Nagle algorithm is enabled; when set to true the Nagle algorithm is disabled (no delay). The default is true.
Public propertyUseStreamMode
Determines if the driver should use either .NET NetworkStream interface (true) or SocketEventArgs interface (false, default) to handle the reading and writing
Top
See Also