public void AddClient(Socket socket) { if (_clients.Count >= _maxClients) { socket.Shutdown(SocketShutdown.Both); socket.Close(); socket.Dispose(); } else { var Client = new GameClient(GenerateClientID(), socket); _clients.Add(Client.ID, Client); Logging.WriteFancyLine("Accepted new client [" + Client.ID + "] from " + Client.IP); } }
public void RemoveClient(GameClient Client) { try { if (Client != null) { Logging.WriteFancyLine("Disconnected client [" + Client.ID + "] from " + Client.IP); Client.Stop(); _clients.Remove(Client.ID); } } catch { } }