28 #ifndef SIMPLETCPSERVER 29 #define SIMPLETCPSERVER 73 size_t maxAllowedUnsentAsyncMessages = MAX_UNSENT_ASYNC_MSG_COUNT,
74 size_t memPoolMsgCount = 0);
98 size_t maxAllowedUnsentAsyncMessages = MAX_UNSENT_ASYNC_MSG_COUNT,
99 size_t memPoolMsgCount = 0);
122 uint16_t ListenPort()
const;
127 size_t NumberOfClients()
const;
132 void CloseAcceptor();
143 bool SendMessageToClientAsync(
154 bool SendMessageToClientSync(
164 bool SendMessageToAllClients(
175 bool SendMessageToClientAsync(
187 bool SendMessageToClientSync(
198 bool SendMessageToAllClients(
211 template <
typename T,
typename A = serialize::archives::out_port_bin_t>
216 return m_tcpTypedServer.SendMessageToClientAsync<T, A>(
217 message, client, messageId, responseAddress);
229 template <
typename T,
typename A = serialize::archives::out_port_bin_t>
234 return m_tcpTypedServer.SendMessageToClientSync<T, A>(
235 message, client, messageId, responseAddress);
246 template <
typename T,
typename A = serialize::archives::out_port_bin_t>
251 return m_tcpTypedServer.SendMessageToAllClients<T, A>(message, messageId, responseAddress);
301 #endif // SIMPLETCPSERVER std::function< void(default_received_message_ptr_t)> default_message_dispatcher_t
Typedef to default message dispatcher function object.
Definition: AsioDefines.h:286
Default message handler class.
Definition: MessageUtils.h:55
The core_lib namespace.
Definition: AsioDefines.h:59
eSendOption
Enumeration to control nagle algorithm.
Definition: AsioDefines.h:82
A generic bi-directional TCP server.
Definition: TcpTypedServer.h:56
A simple bi-directional multi-client TCP server, which uses the class MessageHeader as the message he...
Definition: SimpleTcpServer.h:44
TcpTypedServer< messages::MessageBuilder > m_tcpTypedServer
Our actual typed TCP server object.
Definition: SimpleTcpServer.h:294
nagleOn - Send when possible.
File containing TCP typed server class declaration.
std::pair< std::string, uint16_t > connection_t
Typedef describing a network connection as (address, port).
Definition: AsioDefines.h:152
boost_asio::io_context boost_iocontext_t
Boost IO context convenience typedef.
Definition: AsioDefines.h:46
bool SendMessageToClientSync(const T &message, const defs::connection_t &client, int32_t messageId, const defs::connection_t &responseAddress=defs::NULL_CONNECTION) const
Send a full message to a client synchronously.
Definition: SimpleTcpServer.h:231
Default message builder class.
Definition: MessageUtils.h:268
bool SendMessageToAllClients(const T &message, int32_t messageId, const defs::connection_t &responseAddress=defs::NULL_CONNECTION) const
Send a full message to all clients asynchronously.
Definition: SimpleTcpServer.h:248
std::vector< char > char_buffer_t
Typedef to generic char buffer based on s std::vector<char>.
Definition: AsioDefines.h:239
bool SendMessageToClientAsync(const T &message, const defs::connection_t &client, int32_t messageId, const defs::connection_t &responseAddress=defs::NULL_CONNECTION) const
Send a full message to a client asynchronously.
Definition: SimpleTcpServer.h:212
const connection_t NULL_CONNECTION
Constant defining a null network connection as ("0.0.0.0", 0).