#include <TCPMessageServer.hpp>
Inheritance diagram for Ionflux::Tools::TCPMessageServer:
Public Member Functions | |
TCPMessageServer () | |
Constructor. | |
virtual | ~TCPMessageServer () |
Destructor. | |
virtual void | onMessage (TCPRemotePeer &peer) |
Event handler for received messages. | |
virtual void | onInvalidMessage (TCPRemotePeer &peer) |
Event handler for invalid messages. | |
virtual void | broadcast (const std::string &bytes) |
Broadcast bytes. | |
Protected Member Functions | |
virtual void | onConnect (TCPRemotePeer &client) |
Event handler for new connections. | |
virtual void | onReceive (TCPRemotePeer &client) |
Event handler for received data. |
A Message based TCP server. This works like a TCPServer, except that incoming data is unpacked into a message (if possible). Outgoing data is wrapped into a message and serialized before being sent over the socket.
|
Constructor. Construct new TCPMessageServer object. |
|
Destructor. Destruct TCPMessageServer object. |
|
Broadcast bytes. Sends the specified byte string to all connected peers.
Reimplemented from Ionflux::Tools::TCPServer. Reimplemented in Ionflux::Tools::TCPAuthServer. |
|
Event handler for new connections. This is called by the main loop whenever a new client connects.
Reimplemented from Ionflux::Tools::TCPServer. Reimplemented in Ionflux::Tools::TCPAuthServer. |
|
Event handler for invalid messages. This is called whenever an invalid message is received from a peer.
Implements Ionflux::Tools::MessageHandler. Reimplemented in Ionflux::Tools::TCPAuthServer. |
|
Event handler for received messages. This is called whenever a valid message is received from a peer. The received message will be available from TCPRemotePeer::getMessage().
Implements Ionflux::Tools::MessageHandler. Reimplemented in Ionflux::Tools::TCPAuthServer. |
|
Event handler for received data. This is called by the main loop whenever data is received from a client. The received bytes will be appended to the receive buffer of the remote client.
Reimplemented from Ionflux::Tools::TCPServer. |