示例#1
0
 private void StartServer()
 {
     lanBc.StopBroadcasting();
     lanBc.StartAnnounceBroadcasting();
     udpHandler = new UdpHandler(portGameServer);
     udpHandler.StartListening();
     role = PlayerRole.Server;
     Debug.Log("Starting Server -> " + udpHandler.SessionId);
 }
示例#2
0
        private void ConnectToServer(string ip)
        {
            Debug.Log("Connecting to server: " + ip);
            lanBc.StopBroadcasting();
            udpHandler = new UdpHandler(portGameClient);
            udpHandler.StartListening();
            destAddr = new IPEndPoint(IPAddress.Parse(ip), portGameServer);
            var command = new CommandConnect();

            udpHandler.SendMessage(new UdpMessage(destAddr, command));
            role = PlayerRole.Client;
        }