public static void RemoveConnection(TCP_Client client) { if (userConnections.Contains(client)) { userConnections.Remove(client); } }
private static void OnNewConnection(IAsyncResult iAr) { socket.BeginAccept(new AsyncCallback(OnNewConnection), socket); try { Socket remoteSocket = ((Socket)(iAr.AsyncState)).EndAccept(iAr); TCP_Client usr = new TCP_Client(remoteSocket); userConnections.Add(usr); } catch { } }