public static void RemoveEndPoint(EndPointListener epl, IPEndPoint ep) { lock (ip_to_endpoints) { // Dictionary<int, EndPointListener> p Hashtable p = null; p = (Hashtable)ip_to_endpoints[ep.Address]; p.Remove(ep.Port); if (p.Count == 0) { ip_to_endpoints.Remove(ep.Address); } epl.Close(); } }
public static void RemoveEndPoint(EndPointListener epl, IpEndPointInfo ep) { lock (ip_to_endpoints) { // Dictionary<int, EndPointListener> p Dictionary <int, EndPointListener> p; if (ip_to_endpoints.TryGetValue(ep.IpAddress.Address, out p)) { p.Remove(ep.Port); if (p.Count == 0) { ip_to_endpoints.Remove(ep.IpAddress.Address); } } epl.Close(); } }