The client-class must as mentioned inherit the ClientFramework class as follows:
class MyGameClient : public ClientFramework { // ... your client class members and methods. };
The ClientFramework class declares several abstract methods:
protected: // These must be implemented in a derived class virtual void writeHandshakeInitMessage(FrameworkPacket * fp) = 0; //give first message virtual void onHandshakingDiscontinue(FrameworkPacket * fp) = 0; //recieve virtual bool onHandshakeDescription(FrameworkPacket * fp, FrameworkPacket * reply) = 0; virtual void onDisconnect() = 0; virtual void onConnect() = 0;
The server class must inherit from the ServerFramework class as follows:
class MyGameServer : public ServerFramework { // ... your server class members and methods. };
protected: // These method should be implemented on the GameServer /// This method should write it's reply in the reply-packet, and return true or false depending on wether it want's us to continue the handshaking. virtual bool onInitialHandshake(FrameworkPacket * handshake, FrameworkPacket * reply) = 0; /// This method will be invoked when a new client has passed the handshaking-phase. virtual void onClientConnected(Client * client) = 0; /// This method will be invoked when a client has timed out. virtual void onClientDisconnected(Client * client) = 0; /// This method should return some dirivative of the Client-class. virtual Client * createClient(ServerFramework *fw, const ost::InetHostAddress &addr, ost::tpport_t port) = 0;