sptk2 logo
SPTK Home Page
Public Member Functions | List of all members
sptk::SocketPool Class Reference

#include <SocketPool.h>

Inheritance diagram for sptk::SocketPool:

Public Member Functions

 SocketPool (const SocketEventCallback &eventsCallback)
 
 SocketPool (const SocketPool &) noexcept=delete
 
SocketPooloperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SocketPool() [1/2]

sptk::SocketPool::SocketPool ( const SocketEventCallback &  eventsCallback)
explicit

Constructor

Parameters
eventsCallbackSocketEventCallback, Callback function executed upon socket events

◆ SocketPool() [2/2]

sptk::SocketPool::SocketPool ( const SocketPool )
deletenoexcept

Deleted copy constructor

◆ ~SocketPool()

sptk::SocketPool::~SocketPool ( )

Destructor

Member Function Documentation

◆ active()

bool sptk::SocketPool::active ( ) const
Returns
true if socket pool is active

◆ close()

void sptk::SocketPool::close ( )

Shutdown socket pool.

◆ forgetSocket()

void sptk::SocketPool::forgetSocket ( BaseSocket socket)

Remove socket from monitored pool

Parameters
socketSocket from this pool

◆ open()

void sptk::SocketPool::open ( )

Initialize socket pool

◆ operator=()

SocketPool & sptk::SocketPool::operator= ( const SocketPool )
delete

Deleted copy assignment

◆ waitForEvents()

void sptk::SocketPool::waitForEvents ( std::chrono::milliseconds  timeout) const

Wait until one or more sockets are signaled.

Execute callback function for each signaled socket.

◆ watchSocket()

void sptk::SocketPool::watchSocket ( BaseSocket socket,
uint8_t *  userData 
)

Add socket to monitored pool

Parameters
socketSocket to monitor events
userDataUser data to pass to callback function

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

Fri Oct 14 2022 09:58:45: SPTK 5.4.1