TSDuck v3.45-4686
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::ReactiveTCPServerHandlerInterface Class Reference

Interface class for TCP server Reactor handlers. More...

#include <tsReactiveTCPServerHandlerInterface.h>

Public Member Functions

virtual void handleTCPClientAccepted (ReactiveTCPServer &server, ReactiveTCPConnection &sock, IPSocketAddress &addr, int error_code, const ObjectPtr &user_data)
 Handle the reception of TCP data.
 
virtual void handleTCPServerClosed (ReactiveTCPServer &server, const ObjectPtr &user_data)
 Handle the completion of closing a TCP server socket.
 

Detailed Description

Interface class for TCP server Reactor handlers.

All methods are empty by default. An application may implement the required ones only.

Member Function Documentation

◆ handleTCPClientAccepted()

virtual void ts::ReactiveTCPServerHandlerInterface::handleTCPClientAccepted ( ReactiveTCPServer server,
ReactiveTCPConnection sock,
IPSocketAddress addr,
int  error_code,
const ObjectPtr user_data 
)
virtual

Handle the reception of TCP data.

Parameters
[in,out]serverTCP server socket for which the handler is invoked.
[in,out]sockTCP connection socket of the newly accepted client.
[in]addrSocket address of the client.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, SYS_EOF if the peer has disconnected, SYS_ERROR in case of unknown error.
[in]user_dataThe user-data shared pointer which was passed to startAccept().

◆ handleTCPServerClosed()

virtual void ts::ReactiveTCPServerHandlerInterface::handleTCPServerClosed ( ReactiveTCPServer server,
const ObjectPtr user_data 
)
virtual

Handle the completion of closing a TCP server socket.

An application closes a ReactiveTCPServer using startClose() and this handler is called when the closing of the socket is complete. This is specifically important on operating systems with asynchronous I/O such as Windows. The application shall not call TCPSocket::close() and immediately consider the socket as done. If there are pending asynchronous I/O, the associated data buffers are still in use, until the cancelation of the these I/O are completed, after closing the socket. The application shall therefore wait for the handleTCPClosed() handler to destroy the data buffers and consider the socket as completely done.

Parameters
[in,out]serverTCP server socket for which the handler is invoked.
[in]user_dataThe user-data shared pointer which was passed to startClose().

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