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