public void Stop() { if (ServerComm != null) { ServerComm.Stop(); } if (Connection != null) { Connection.Stop(); } }
//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(); } } }
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(); } }