private void SendClientListUpdateToAll(object custruct) { ClientUpdateStruct cu_struct = (ClientUpdateStruct)custruct; IM_Message message = null; switch (cu_struct.type) { case IM_Message.MESSAGE_TYPE_CLIENT_CONNECTED: message = new IM_Message("SERVER", String.Empty, IM_Message.MESSAGE_TYPE_CLIENT_CONNECTED, cu_struct.name); break; case IM_Message.MESSAGE_TYPE_CLIENT_DISCONNECTED: message = new IM_Message("SERVER", String.Empty, IM_Message.MESSAGE_TYPE_CLIENT_DISCONNECTED, cu_struct.name); break; case IM_Message.MESSAGE_TYPE_CLIENT_NAME_CHANGE: //Message will be intercepted so that it's not sent to the client in the TO field //NAME_CHANGE messages will not be forwarded message = new IM_Message(cu_struct.name, String.Empty, IM_Message.MESSAGE_TYPE_CLIENT_NAME_CHANGE, cu_struct.extra); break; default: break; } Monitor.Enter(ListLock); List <Client> buffer = new List <Client>( clients.Cast <Client>() /*.Where(x => !x.Name.StartsWith("_|___|__|___|_"))*/ ); //don't want to include temporary names foreach (Client c in buffer) { if (cu_struct.name != c.Name) { //Set the TO field here message.To = c.Name; Thread.Sleep(500); c.Send(message); } } Monitor.Exit(ListLock); }