#include <connectionhandler.hpp>
Inheritance diagram for ConnectionHandler:

The connection handler will respond to connect/reconnect/disconnect events and handle incoming messages, passing them on to registered message handlers.
Definition at line 39 of file connectionhandler.hpp.
Public Member Functions | |
| virtual | ~ConnectionHandler () |
| bool | startListen (enet_uint16 port) |
| Open the server socket. | |
| void | stopListen () |
| Disconnect all the clients and close the server socket. | |
| virtual void | process (enet_uint32 timeout=0) |
| Process outgoing messages and listen to the server socket for incoming messages and new connections. | |
| void | flush () |
| Process outgoing messages. | |
| void | sendToEveryone (const MessageOut &msg) |
| Send packet to every client, used for announcements. | |
| unsigned int | getClientNumber () |
| Return the number of connected clients. | |
Protected Types | |
| typedef std::list< NetComputer * > | NetComputers |
Protected Member Functions | |
| virtual NetComputer * | computerConnected (ENetPeer *peer)=0 |
| Called when a computer connects to the server. | |
| virtual void | computerDisconnected (NetComputer *)=0 |
| Called when a computer disconnects from the server. | |
| virtual void | processMessage (NetComputer *, MessageIn &)=0 |
| Called when a message is received. | |
Protected Attributes | |
| NetComputers | clients |
| A list of pointers to the client structures created by computerConnected. | |
Private Attributes | |
| ENetAddress | address |
| Includes the port to listen to. | |
| ENetHost * | host |
| The host that listen for connections. | |
|
|
Definition at line 112 of file connectionhandler.hpp. |
|
|
Definition at line 42 of file connectionhandler.hpp. |
|
|
Called when a computer connects to the server. Initialize an object derived of NetComputer. Implemented in AccountHandler, ServerHandler, ChatHandler, and GameHandler. |
|
|
Called when a computer disconnects from the server. Note: After returning from this method the NetComputer reference is no longer guaranteed to be valid. Implemented in AccountHandler, ServerHandler, ChatHandler, and GameHandler. |
|
|
Process outgoing messages.
Definition at line 71 of file connectionhandler.cpp. |
|
|
Return the number of connected clients.
Definition at line 151 of file connectionhandler.cpp. |
|
|
Process outgoing messages and listen to the server socket for incoming messages and new connections. an optional timeout in milliseconds to wait for something to happen when there is nothing to do Reimplemented in ChatHandler. Definition at line 76 of file connectionhandler.cpp. |
|
||||||||||||
|
Called when a message is received.
Implemented in AccountHandler, ServerHandler, ChatHandler, and GameHandler. |
|
|
Send packet to every client, used for announcements.
Definition at line 142 of file connectionhandler.cpp. |
|
|
Open the server socket.
Reimplemented in AccountHandler, ServerHandler, ChatHandler, and GameHandler. Definition at line 34 of file connectionhandler.cpp. |
|
|
Disconnect all the clients and close the server socket.
Definition at line 49 of file connectionhandler.cpp. |
|
|
Includes the port to listen to.
Definition at line 84 of file connectionhandler.hpp. |
|
|
A list of pointers to the client structures created by computerConnected.
Definition at line 117 of file connectionhandler.hpp. |
|
|
The host that listen for connections.
Definition at line 85 of file connectionhandler.hpp. |
1.3.9.1