Hazelcast C++ Client
SocketOptions.h
1 /*
2  * Copyright (c) 2008-2018, 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 #ifndef HAZELCAST_CLIENT_CONFIG_SOCKETOPTIONS_H_
17 #define HAZELCAST_CLIENT_CONFIG_SOCKETOPTIONS_H_
18 
19 #include "hazelcast/util/HazelcastDll.h"
20 
21 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
22 #pragma warning(push)
23 #pragma warning(disable: 4251) //for dll export
24 #endif
25 
26 namespace hazelcast {
27  namespace client {
28  namespace config {
32  class HAZELCAST_API SocketOptions {
33  public:
37  static const int KILO_BYTE = 1024;
38 
42  static const int DEFAULT_BUFFER_SIZE_BYTE = 128 * KILO_BYTE;
43 
44  SocketOptions();
45 
51  bool isTcpNoDelay() const;
52 
58  SocketOptions &setTcpNoDelay(bool tcpNoDelay);
59 
65  bool isKeepAlive() const;
66 
73  SocketOptions &setKeepAlive(bool keepAlive);
74 
80  bool isReuseAddress() const;
81 
88  SocketOptions &setReuseAddress(bool reuseAddress);
89 
94  int getLingerSeconds() const;
95 
106  SocketOptions &setLingerSeconds(int lingerSeconds);
107 
116  int getBufferSizeInBytes() const;
117 
128  SocketOptions &setBufferSizeInBytes(int bufferSize);
129 
130  private:
131  // socket options
132 
133  bool tcpNoDelay;
134 
135  bool keepAlive;
136 
137  bool reuseAddress;
138 
139  int lingerSeconds;
140 
141  int bufferSize;
142 
143  };
144 
145  }
146  }
147 }
148 
149 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
150 #pragma warning(pop)
151 #endif
152 
153 #endif /* HAZELCAST_CLIENT_CONFIG_SOCKETOPTIONS_H_ */
TCP Socket options.
Definition: SocketOptions.h:32
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32