diff --git a/Lidgren.Network/NetServer.cs b/Lidgren.Network/NetServer.cs index 99a198f..85c37ed 100644 --- a/Lidgren.Network/NetServer.cs +++ b/Lidgren.Network/NetServer.cs @@ -35,6 +35,25 @@ namespace Lidgren.Network SendMessage(msg, all, method, 0); } + /// + /// Send a message to all connections + /// + /// The message to send + /// How to deliver the message + /// Which sequence channel to use for the message + public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method, int sequenceChannel) + { + // Modifying m_connections will modify the list of the connections of the NetPeer. Do only reads here + var all = m_connections; + if (all.Count <= 0) { + if (msg.m_isSent == false) + Recycle(msg); + return; + } + + SendMessage(msg, all, method, sequenceChannel); + } + /// /// Send a message to all connections except one ///