netLink C++ 11
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
netLink::SocketManager Class Reference

Manages a group of Sockets. More...

#include <netLink.h>

Public Member Functions

std::shared_ptr< SocketnewSocket ()
 Allocates a new Socket, inserts it into sockets and returns it.
 
std::shared_ptr< SocketnewMsgPackSocket ()
 Allocates a new MsgPackSocket, inserts it into sockets and returns it.
 
void listen (double waitUpToSeconds=0.0)
 

Public Attributes

std::function< bool(SocketManager *manager, std::shared_ptr< Socket > serverSocket, std::shared_ptr< Socket > clientSocket)> onConnectRequest
 Event which is called if a TCP_SERVER accepts a new connection (if false is returned the connection will be closed immediately)
 
std::function< void(SocketManager *manager, std::shared_ptr< Socket > socket, Socket::Status prev)> onStatusChange
 Event which is called if a socket can or can not send more data (also called if nonblocking connect succeeded)
 
std::function< void(SocketManager *manager, std::shared_ptr< Socket > socket)> onReceiveRaw
 Event which is called if a socket receives new raw data.
 
std::function< void(SocketManager *manager, std::shared_ptr< Socket > socket, std::unique_ptr< MsgPack::Element > element)> onReceiveMsgPack
 Event which is called if a socket receives a MsgPack::Element.
 
std::set< std::shared_ptr< Socket > > sockets
 Sockets which are managed.
 

Detailed Description

Manages a group of Sockets.

Member Function Documentation

◆ listen()

void netLink::SocketManager::listen ( double  waitUpToSeconds = 0.0)

Listens a periode time

Parameters
waitUpToSecondsMaximum time to wait for incoming data in seconds or negative values to wait indefinitely

The documentation for this class was generated from the following files: