/// <summary> /// A message was recived /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnMessageReceived(object sender, MessageReceivedEventArgs args) { foreach (var client in ActiveClients.ToList()) { var results = SendMessage(client.Value, args.Message); if (results == false) { Debug.WriteLine("Connection from {0}:{1} to {2}:{3} was disconnected", client.Value.Information.RemoteHostName.DisplayName, client.Value.Information.RemotePort, client.Value.Information.LocalAddress.DisplayName, client.Value.Information.LocalPort); client.Value.Dispose(); ActiveClients.Remove(client.Key); } } }