Hazelcast C++ Client
Hazelcast C++ Client Library
hazelcast::client::config::socket_options Class Reference

TCP Socket options. More...

#include <socket_options.h>

Public Member Functions

bool is_tcp_no_delay () const
 TCP_NODELAY socket option. More...
 
socket_optionsset_tcp_no_delay (bool tcp_no_delay)
 Enable/disable TCP_NODELAY socket option. More...
 
bool is_keep_alive () const
 SO_KEEPALIVE socket option. More...
 
socket_optionsset_keep_alive (bool keep_alive)
 Enable/disable SO_KEEPALIVE socket option. More...
 
bool is_reuse_address () const
 SO_REUSEADDR socket option. More...
 
socket_optionsset_reuse_address (bool reuse_address)
 Enable/disable the SO_REUSEADDR socket option. More...
 
int get_linger_seconds () const
 Gets SO_LINGER with the specified linger time in seconds. More...
 
socket_optionsset_linger_seconds (int linger_seconds)
 Enable/disable SO_LINGER with the specified linger time in seconds. More...
 
int get_buffer_size_in_bytes () const
 If set to 0 or less, then it is not set on the socket. More...
 
socket_optionsset_buffer_size_in_bytes (int buffer_size)
 If set to 0 or less, then it is not set on the socket. More...
 

Static Public Attributes

static const int KILO_BYTE = 1024
 constant for kilobyte
 
static const int DEFAULT_BUFFER_SIZE_BYTE = 128 * KILO_BYTE
 default buffer size of Bytes
 

Detailed Description

TCP Socket options.

Definition at line 31 of file socket_options.h.

Member Function Documentation

◆ get_buffer_size_in_bytes()

int hazelcast::client::config::socket_options::get_buffer_size_in_bytes ( ) const

If set to 0 or less, then it is not set on the socket.

The default value is DEFAULT_BUFFER_SIZE_BYTE

Gets the SO_SNDBUF and SO_RCVBUF options value in bytes

Returns
bufferSize Number of bytes

Definition at line 420 of file config.cpp.

420  {
421  return buffer_size_;
422  }

◆ get_linger_seconds()

int hazelcast::client::config::socket_options::get_linger_seconds ( ) const

Gets SO_LINGER with the specified linger time in seconds.

Returns
lingerSeconds value in seconds

Definition at line 411 of file config.cpp.

411  {
412  return linger_seconds_;
413  }

◆ is_keep_alive()

bool hazelcast::client::config::socket_options::is_keep_alive ( ) const

SO_KEEPALIVE socket option.

Returns
true if enabled

Definition at line 393 of file config.cpp.

393  {
394  return keep_alive_;
395  }

◆ is_reuse_address()

bool hazelcast::client::config::socket_options::is_reuse_address ( ) const

SO_REUSEADDR socket option.

Returns
true if enabled

Definition at line 402 of file config.cpp.

402  {
403  return reuse_address_;
404  }

◆ is_tcp_no_delay()

bool hazelcast::client::config::socket_options::is_tcp_no_delay ( ) const

TCP_NODELAY socket option.

Returns
true if enabled

Definition at line 384 of file config.cpp.

384  {
385  return tcp_no_delay_;
386  }

◆ set_buffer_size_in_bytes()

socket_options & hazelcast::client::config::socket_options::set_buffer_size_in_bytes ( int  buffer_size)

If set to 0 or less, then it is not set on the socket.

The default value is DEFAULT_BUFFER_SIZE_BYTE

Sets the SO_SNDBUF and SO_RCVBUF options to the specified value in bytes

Parameters
bufferSizeNumber of bytes
Returns
SocketOptions configured

Definition at line 424 of file config.cpp.

424  {
425  socket_options::buffer_size_ = buffer_size;
426  return *this;
427  }

◆ set_keep_alive()

socket_options & hazelcast::client::config::socket_options::set_keep_alive ( bool  keep_alive)

Enable/disable SO_KEEPALIVE socket option.

Parameters
keepAliveenabled if true
Returns
SocketOptions configured

Definition at line 397 of file config.cpp.

397  {
398  socket_options::keep_alive_ = keep_alive;
399  return *this;
400  }

◆ set_linger_seconds()

socket_options & hazelcast::client::config::socket_options::set_linger_seconds ( int  linger_seconds)

Enable/disable SO_LINGER with the specified linger time in seconds.

if set to a value of 0 or less then it is disabled.

Default value is 3.

Parameters
lingerSecondsvalue in seconds
Returns
SocketOptions configured

Definition at line 415 of file config.cpp.

415  {
416  socket_options::linger_seconds_ = linger_seconds;
417  return *this;
418  }

◆ set_reuse_address()

socket_options & hazelcast::client::config::socket_options::set_reuse_address ( bool  reuse_address)

Enable/disable the SO_REUSEADDR socket option.

Parameters
reuseAddressenabled if true
Returns
SocketOptions configured

Definition at line 406 of file config.cpp.

406  {
407  socket_options::reuse_address_ = reuse_address;
408  return *this;
409  }

◆ set_tcp_no_delay()

socket_options & hazelcast::client::config::socket_options::set_tcp_no_delay ( bool  tcp_no_delay)

Enable/disable TCP_NODELAY socket option.

Parameters
tcpNoDelay

Definition at line 388 of file config.cpp.

388  {
389  socket_options::tcp_no_delay_ = tcp_no_delay;
390  return *this;
391  }

The documentation for this class was generated from the following files: