/// <summary> /// Shutdown the server socket. /// </summary> public void Shutdown() { for (int i = 0; i < clients.Length; i++) { if (clients[i] != null) { SendMsg(i, UCCommand.ServerShutDown); } } DebugUtilities.Log("Notified all clients."); NetworkUtilities.ShutdownSocket(serverSocket); }
private void DeregisterClient(Socket socket, int playerId) { if (playerId < clients.Length && clients[playerId] != null) { cmdHandler.Deregister(playerId); // Todo: Toggle this line for testing later. NetworkUtilities.ShutdownSocket(clients[playerId]); clients[playerId] = null; // release space for new client } else { PlayerNotFound(socket, playerId); } }