Пример #1
0
 public static void StartBroadCasting()
 {
     if (Netplay.broadcastThread != null)
     {
         Netplay.StopBroadCasting();
     }
     Netplay.broadcastThread = new Thread(new ThreadStart(Netplay.BroadcastThread));
     Netplay.broadcastThread.Start();
 }
Пример #2
0
        private static void ServerLoop()
        {
            int num = 0;

            Netplay.StartBroadCasting();
            while (!Netplay.Disconnect)
            {
                Netplay.StartListeningIfNeeded();
                Netplay.UpdateConnectedClients();
                num = (num + 1) % 10;
                Thread.Sleep(num == 0 ? 1 : 0);
            }
            Netplay.StopBroadCasting();
            Netplay.CleanupServer();
        }