![]() |
||||||||
|
|
||||||||
class Client : public ZCom_Control { virtual void ZCom_cbConnectResult( ZCom_ConnID _id, eZCom_ConnectResult _result, ZCom_BitStream &_reply ) { if (_result == eZCom_ConnAccepted) { printf("Connection established.\n"); ZCom_requestZoidMode(_id, 1); } else printf("Connection failed\n"); } // all other callback methods omitted here };
This requests to enter Zoidlevel 1 directly after the connection has been established.
class Server : public ZCom_Control { bool ZCom_cbZoidRequest( ZCom_ConnID _id, zU8 _requested_level, ZCom_BitStream &_reason ) { // return true to grant the request, or false to deny it if (_requested_level == 1) return true; else return false; } // all other callback methods omitted here };
This code will accept all requests to enter Zoidlevel 1. After a request has been accepted, the server will start replicating nodes from level 1 to the client.
class Client : public ZCom_Control { void ZCom_cbZoidResult( ZCom_ConnID _id, eZCom_ZoidResult _result, zU8 _new_level, ZCom_BitStream & _reason ) { if (_result == eZCom_ZoidEnabled) printf("Zoidlevel %d entered\n", _new_level); else printf("Failed entering Zoidlevel %d\n", _new_level); } // all other callback methods omitted here };
When entering a Zoidlevel for the first time, server and client will exchange their class registries. If the server knows a class which the client does not, the client will receive the result eZCom_ZoidFailed_System as _result parameter to the zoid result callback.
1.4.6-NO