Nanomsg client.
More...
#include <client.h>
Nanomsg client.
Nanomsg client is used to send messages to the Nanomsg server and receive responses back.
Thread-safe.
Definition at line 29 of file client.h.
◆ Client() [1/3]
CppServer::Nanomsg::Client::Client |
( |
Domain |
domain, |
|
|
Protocol |
protocol, |
|
|
const std::string & |
address, |
|
|
bool |
threading = true |
|
) |
| |
|
explicit |
Initialize client with a given domain, protocol and endpoint address.
- Parameters
-
domain | - Domain |
protocol | - Protocol |
address | - Endpoint address |
threading | - Run the client in a separate thread (default is true) |
Definition at line 19 of file client.cpp.
◆ Client() [2/3]
CppServer::Nanomsg::Client::Client |
( |
const Client & |
| ) |
|
|
delete |
◆ Client() [3/3]
CppServer::Nanomsg::Client::Client |
( |
Client && |
| ) |
|
|
default |
◆ ~Client()
CppServer::Nanomsg::Client::~Client |
( |
| ) |
|
|
virtual |
◆ Connect()
bool CppServer::Nanomsg::Client::Connect |
( |
| ) |
|
◆ Disconnect()
bool CppServer::Nanomsg::Client::Disconnect |
( |
| ) |
|
Disconnect the client.
- Returns
- 'true' if the client was successfully disconnected, 'false' if the client is already disconnected
Definition at line 73 of file client.cpp.
◆ IsConnected()
bool CppServer::Nanomsg::Client::IsConnected |
( |
| ) |
const |
|
inlinenoexcept |
Is the client connected?
Definition at line 51 of file client.h.
◆ onConnected()
virtual void CppServer::Nanomsg::Client::onConnected |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ onDisconnected()
virtual void CppServer::Nanomsg::Client::onDisconnected |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ onError()
virtual void CppServer::Nanomsg::Client::onError |
( |
int |
error, |
|
|
const std::string & |
message |
|
) |
| |
|
inlineprotectedvirtual |
◆ onIdle()
virtual void CppServer::Nanomsg::Client::onIdle |
( |
| ) |
|
|
inlineprotectedvirtual |
Handle client idle notification.
Definition at line 141 of file client.h.
◆ onReceived()
virtual void CppServer::Nanomsg::Client::onReceived |
( |
Message & |
message | ) |
|
|
inlineprotectedvirtual |
◆ onThreadCleanup()
virtual void CppServer::Nanomsg::Client::onThreadCleanup |
( |
| ) |
|
|
inlineprotectedvirtual |
Cleanup thread handler.
This handler can be used to cleanup priority or affinity of the client thread.
Definition at line 133 of file client.h.
◆ onThreadInitialize()
virtual void CppServer::Nanomsg::Client::onThreadInitialize |
( |
| ) |
|
|
inlineprotectedvirtual |
Initialize thread handler.
This handler can be used to initialize priority or affinity of the client thread.
Definition at line 128 of file client.h.
◆ operator=() [1/2]
Client& CppServer::Nanomsg::Client::operator= |
( |
const Client & |
| ) |
|
|
delete |
◆ operator=() [2/2]
◆ Receive()
size_t CppServer::Nanomsg::Client::Receive |
( |
Message & |
message | ) |
|
Receive a message from the server.
- Parameters
-
- Returns
- Count of received bytes
Definition at line 189 of file client.cpp.
◆ Reconnect()
bool CppServer::Nanomsg::Client::Reconnect |
( |
| ) |
|
Reconnect the client.
- Returns
- 'true' if the client was successfully reconnected, 'false' if the client failed to reconnect
Definition at line 100 of file client.cpp.
◆ Send() [1/3]
size_t CppServer::Nanomsg::Client::Send |
( |
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
◆ Send() [2/3]
size_t CppServer::Nanomsg::Client::Send |
( |
const std::string & |
text | ) |
|
|
inline |
Send a text string to the server.
- Parameters
-
text | - Text string to send |
- Returns
- Count of sent bytes
Definition at line 81 of file client.h.
◆ Send() [3/3]
size_t CppServer::Nanomsg::Client::Send |
( |
const Message & |
message | ) |
|
|
inline |
Send a message to the server.
- Parameters
-
- Returns
- Count of sent bytes
Definition at line 87 of file client.h.
◆ socket()
Socket& CppServer::Nanomsg::Client::socket |
( |
| ) |
|
|
inlinenoexcept |
◆ TryReceive()
size_t CppServer::Nanomsg::Client::TryReceive |
( |
Message & |
message | ) |
|
Try to receive a message from the server in non-blocking mode.
- Parameters
-
- Returns
- Count of received bytes
Definition at line 211 of file client.cpp.
◆ TrySend() [1/3]
size_t CppServer::Nanomsg::Client::TrySend |
( |
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
Try to send data to the server in non-blocking mode.
- Parameters
-
buffer | - Buffer to send |
size | - Buffer size |
- Returns
- Count of sent bytes
Definition at line 173 of file client.cpp.
◆ TrySend() [2/3]
size_t CppServer::Nanomsg::Client::TrySend |
( |
const std::string & |
text | ) |
|
|
inline |
Try to send a text string to the server in non-blocking mode.
- Parameters
-
text | - Text string to send |
- Returns
- Count of sent bytes
Definition at line 101 of file client.h.
◆ TrySend() [3/3]
size_t CppServer::Nanomsg::Client::TrySend |
( |
const Message & |
message | ) |
|
|
inline |
Try to send a message to the server in non-blocking mode.
- Parameters
-
- Returns
- Count of sent bytes
Definition at line 107 of file client.h.
The documentation for this class was generated from the following files: