CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::NetworkConnectionReceiver Class Referenceabstract

Callback interface for asynchronous delivery of newly accepted connections. More...

#include <NetworkConnections.h>

Public Member Functions

 NetworkConnectionReceiver ()
virtual bool receiveNetworkConnection (NetworkConnection *con)=0
 Called when the listener has accepted a new connection.
virtual bool registerError (uint16 error, TCPListener *con)=0
 Called when the listener encounters an error.

Detailed Description

Callback interface for asynchronous delivery of newly accepted connections.

Implemented by objects (e.g. NetworkChannel internals) that want a TCPListener to run its own accept loop thread and hand over each inbound connection instead of the owner calling TCPListener::acceptConnection() synchronously.

Note
Callbacks are invoked on the listener's internal thread.

Definition at line 393 of file NetworkConnections.h.

Constructor & Destructor Documentation

◆ NetworkConnectionReceiver()

cmlabs::NetworkConnectionReceiver::NetworkConnectionReceiver ( )
inline

Definition at line 395 of file NetworkConnections.h.

Member Function Documentation

◆ receiveNetworkConnection()

virtual bool cmlabs::NetworkConnectionReceiver::receiveNetworkConnection ( NetworkConnection * con)
pure virtual

Called when the listener has accepted a new connection.

Parameters
conThe newly created connection; ownership transfers to the receiver, which must eventually delete it.
Returns
true if the connection was taken; false to have it discarded.

◆ registerError()

virtual bool cmlabs::NetworkConnectionReceiver::registerError ( uint16 error,
TCPListener * con )
pure virtual

Called when the listener encounters an error.

Parameters
errorOne of the NETWORKERROR_* codes.
conThe listener reporting the error (not owned by the receiver).
Returns
true if the error was handled.

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