|
#include <SocketPool.h>
Public Member Functions | |
| SocketPool (const SocketEventCallback &eventsCallback) | |
| SocketPool (const SocketPool &) noexcept=delete | |
| SocketPool & | operator= (const SocketPool &)=delete |
| void | open () |
| ~SocketPool () | |
| void | waitForEvents (std::chrono::milliseconds timeout) const |
| void | close () |
| void | watchSocket (BaseSocket &socket, uint8_t *userData) |
| void | forgetSocket (BaseSocket &socket) |
| bool | active () const |
Socket event manager.
Uses OS-specific implementation. On Linux it is using epoll, on BSD it is using kqueue, and on Windows WSAAsyncSelect is used.
|
explicit |
Constructor
| eventsCallback | SocketEventCallback, Callback function executed upon socket events |
|
deletenoexcept |
Deleted copy constructor
| sptk::SocketPool::~SocketPool | ( | ) |
Destructor
| bool sptk::SocketPool::active | ( | ) | const |
| void sptk::SocketPool::close | ( | ) |
Shutdown socket pool.
| void sptk::SocketPool::forgetSocket | ( | BaseSocket & | socket | ) |
Remove socket from monitored pool
| socket | Socket from this pool |
| void sptk::SocketPool::open | ( | ) |
Initialize socket pool
|
delete |
Deleted copy assignment
| void sptk::SocketPool::waitForEvents | ( | std::chrono::milliseconds | timeout | ) | const |
Wait until one or more sockets are signaled.
Execute callback function for each signaled socket.
| void sptk::SocketPool::watchSocket | ( | BaseSocket & | socket, |
| uint8_t * | userData | ||
| ) |
Add socket to monitored pool
| socket | Socket to monitor events |
| userData | User data to pass to callback function |