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 575 of file config.cpp.

576 {
577  return buffer_size_;
578 }

◆ 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 562 of file config.cpp.

563 {
564  return linger_seconds_;
565 }

◆ is_keep_alive()

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

SO_KEEPALIVE socket option.

Returns
true if enabled

Definition at line 536 of file config.cpp.

537 {
538  return keep_alive_;
539 }

◆ is_reuse_address()

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

SO_REUSEADDR socket option.

Returns
true if enabled

Definition at line 549 of file config.cpp.

550 {
551  return reuse_address_;
552 }

◆ 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 523 of file config.cpp.

524 {
525  return tcp_no_delay_;
526 }

◆ 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 581 of file config.cpp.

582 {
583  socket_options::buffer_size_ = buffer_size;
584  return *this;
585 }

◆ 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 542 of file config.cpp.

543 {
544  socket_options::keep_alive_ = keep_alive;
545  return *this;
546 }

◆ 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 568 of file config.cpp.

569 {
570  socket_options::linger_seconds_ = linger_seconds;
571  return *this;
572 }

◆ 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 555 of file config.cpp.

556 {
557  socket_options::reuse_address_ = reuse_address;
558  return *this;
559 }

◆ 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 529 of file config.cpp.

530 {
531  socket_options::tcp_no_delay_ = tcp_no_delay;
532  return *this;
533 }

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