Babel
Epitech's C++ VoIP project
|
Implementation of ITCPServer using ASIO. More...
#include <AsioTCPServer.hpp>
Public Member Functions | |
bool | start (uint16_t port) override |
Starts the server on indicated port. More... | |
void | stop () override |
Stop the server. More... | |
void | messageClient (std::shared_ptr< ITCPConnection< T >> client, const Message< T > &msg) override |
Send a message to the specified client. More... | |
void | messageAllClients (const Message< T > &msg) override |
Send a message to all connected clients. More... | |
void | update (uint64_t nbMessagesToProcess, bool wait) override |
Forces the server to call callbacks. More... | |
bool | onClientConnect (std::shared_ptr< ITCPConnection< T >> client) override |
Called when a client connect. More... | |
void | onClientDisconnect (std::shared_ptr< ITCPConnection< T >> client) override |
Called when a client disconnect. More... | |
void | onMessage (std::shared_ptr< ITCPConnection< T >> client, Message< T > &msg) override |
Called when we received a message from a client. More... | |
~AsioTCPServer () override | |
default dtor More... | |
AsioTCPServer () | |
ctor More... | |
![]() | |
virtual | ~ITCPServer ()=default |
default dtor More... | |
Protected Member Functions | |
void | waitForClientConnections () |
Listens for client messages. More... | |
Protected Attributes | |
TSQueue< OwnedMessage< T > > | _messagesIn |
Received messages from clients. More... | |
std::deque< std::shared_ptr< ITCPConnection< T > > > | _connections |
All the active connections. More... | |
asio::io_context | _ioContext |
Server's asio context. More... | |
std::thread | _contextThread |
Thread running the asio context. More... | |
asio::ip::tcp::acceptor | _acceptor |
The acceptor. More... | |
uint64_t | _idCounter = 0 |
The counter to set connections ids. More... | |
Implementation of ITCPServer using ASIO.
|
override |
default dtor
|
explicit |
ctor
|
overridevirtual |
Send a message to all connected clients.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Send a message to the specified client.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Called when a client connect.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Called when a client disconnect.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Called when we received a message from a client.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Starts the server on indicated port.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Stop the server.
Implements Babel::ITCPServer< T >.
|
overridevirtual |
Forces the server to call callbacks.
Implements Babel::ITCPServer< T >.
|
protected |
Listens for client messages.
|
protected |
The acceptor.
|
protected |
All the active connections.
|
protected |
Thread running the asio context.
|
protected |
The counter to set connections ids.
|
protected |
Server's asio context.
|
protected |
Received messages from clients.