Esempio n. 1
0
        public void Initialize(short scopeMsgType, NetworkClient currentClient, MasterClient masterClient)
        {
            msgType = scopeMsgType;

            client       = currentClient;
            MasterClient = masterClient;

            // register with the Client's Scope msgType
            client.RegisterHandler(msgType, ProcessMessage);

            base.Initialize();
        }
        public void StartServer(int port)
        {
            HostTopology topology = new HostTopology(MasterClient.CreateConnectionConfig(), 3000);

            NetworkServer.Configure(topology);

            NetworkServer.SetNetworkConnectionClass <TPeer>();

            NetworkServer.Listen(port);

            NetworkServer.RegisterHandler(MsgType.Connect, OnPeerConnectedMsg);
            NetworkServer.RegisterHandler(MsgType.Disconnect, OnPeerDisconnectedMsg);
        }