Example #1
0
 public RemoteBattle(NetworkManager.PType protocolType, int port)
 {
     NetworkManager.AddPacketTypes();
     NetworkManager.CreateServer(NETWORK_NAME, protocolType, 10);
     NetworkManager.AddServerEventHandler(NETWORK_NAME, this.ProcessServerEvent);
     NetworkManager.StartServer(NETWORK_NAME, port);
     Logger.Log($"Server started, listening port: {port}");
 }
Example #2
0
        public NetworkTest()
        {
            NetworkManager.AddPacketTypes();
            NetworkManager.CreateServer(SERVER_NAME, NetworkManager.PType.Tcp, 10);
            NetworkManager.AddServerEventHandler(SERVER_NAME, this.ProcessServerEvent);
            NetworkManager.StartServer(SERVER_NAME, 2551);

            NetworkManager.CreateClient(CLIENT_NAME, NetworkManager.PType.Tcp);
            NetworkManager.AddClientEventHandler(CLIENT_NAME, this.ProcessClientEvent);
            NetworkManager.Connect(CLIENT_NAME, "127.0.0.1", 2551);

            int i = 300;

            while (i > 0)
            {
                NetworkManager.Update(10);
                Thread.Sleep(10);
                --i;
            }
            NetworkManager.Dispose();
        }