public void SendForEach() { lock (_lock) { foreach (ServerSession s in _sessions) { C_Chat chatPacket = new C_Chat(); chatPacket.chat = $"Hello Server!"; ArraySegment <byte> segment = chatPacket.Write(); s.Send(segment); } } }
public void SendForEach() { lock (m_lock) { foreach (ServerSession session in m_sessions) { C_Chat chatPacket = new C_Chat(); chatPacket.chat = $"Hello Server!"; ArraySegment <byte> sg = chatPacket.Write(); session.Send(sg); } } }