|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Callback interface for asynchronous (push) delivery of received bytes. More...
#include <NetworkConnections.h>
Public Member Functions | |
| NetworkDataReceiver () | |
| virtual bool | receiveData (char *data, uint32 size, NetworkConnection *con)=0 |
| Called when data has been read from the socket. | |
| virtual bool | registerError (uint16 error, NetworkConnection *con)=0 |
| Called when the connection encounters an error (e.g. | |
Callback interface for asynchronous (push) delivery of received bytes.
When a NetworkDataReceiver is attached to a connection at connect() time, the connection runs its own reader thread and pushes raw bytes to receiveData() as they arrive, instead of the owner pulling data with NetworkConnection::receive(). Protocol parsing on top of these raw bytes is the receiver's responsibility.
Definition at line 417 of file NetworkConnections.h.
|
inline |
Definition at line 419 of file NetworkConnections.h.
|
pure virtual |
Called when data has been read from the socket.
| data | Pointer to the received bytes; ownership transfers to the receiver (allocated with new[]; delete with delete[]). |
| size | Number of valid bytes at data. |
| con | The connection the data arrived on (not owned). |
|
pure virtual |
Called when the connection encounters an error (e.g.
peer disconnect).
| error | One of the NETWORKERROR_* codes. |
| con | The connection reporting the error (not owned). |