예제 #1
0
 public void Stop()
 {
     if (ServerComm != null)
     {
         ServerComm.Stop();
     }
     if (Connection != null)
     {
         Connection.Stop();
     }
 }
예제 #2
0
 //nicely shutdown listening threads, and notify the server/other player
 static public void Stop()
 {
     if (Client != null && Server == null)
     {
         Client.Send((new MSGQuit(GetUserName())).ToString()); //client notify server
         Thread.Sleep(1000);
         Client.Stop();
     }
     if (Server != null)
     {
         Server.BroadCast((new MSGQuit("ServerHasToQuit\t" + GetUserName())).ToString()); //server notify everybody else
         Thread.Sleep(1000);
         if (Server.ServerComm != null)
         {
             Server.Stop();
         }
         if (Client != null)
         {
             Client.Stop();
         }
     }
 }
예제 #3
0
 private void Quit()
 {
     if (Client != null)
     {
         if (IsDispatcher)
         {
             //    Client.Send((new MSGQuit("ServerHasToQuit\t" + GetUserName())).ToString()); //server notify everybody else
         }
         //else
         {
             Client.SendMessage((new MSGQuit(GetUserName())).ToString()).Wait(); //client notify server
         }
         Client.Stop();
     }
 }