Hazelcast C++ Client
Hazelcast C++ Client Library
socket_options.h
1 /*
2  * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "hazelcast/util/export.h"
19 
20 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
21 #pragma warning(push)
22 #pragma warning(disable: 4251) //for dll export
23 #endif
24 
25 namespace hazelcast {
26  namespace client {
27  namespace config {
31  class HAZELCAST_API socket_options {
32  public:
36  static const int KILO_BYTE = 1024;
37 
41  static const int DEFAULT_BUFFER_SIZE_BYTE = 128 * KILO_BYTE;
42 
44 
50  bool is_tcp_no_delay() const;
51 
57  socket_options &set_tcp_no_delay(bool tcp_no_delay);
58 
64  bool is_keep_alive() const;
65 
72  socket_options &set_keep_alive(bool keep_alive);
73 
79  bool is_reuse_address() const;
80 
87  socket_options &set_reuse_address(bool reuse_address);
88 
93  int get_linger_seconds() const;
94 
105  socket_options &set_linger_seconds(int linger_seconds);
106 
115  int get_buffer_size_in_bytes() const;
116 
127  socket_options &set_buffer_size_in_bytes(int buffer_size);
128 
129  private:
130  // socket options
131 
132  bool tcp_no_delay_;
133 
134  bool keep_alive_;
135 
136  bool reuse_address_;
137 
138  int linger_seconds_;
139 
140  int buffer_size_;
141 
142  };
143 
144  }
145  }
146 }
147 
148 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
149 #pragma warning(pop)
150 #endif
151 
152