예제 #1
0
        public void BroadcastMessage(INetMessage msg, IRecipientFilter filter)
        {
            if (filter.IsInitMessage())
            {
                if (!msg.WriteToBuffer(Signon))
                {
                    Out.Warning("BaseServer.BroadcastMessage: Init message would overflow signon buffer!");
                }

                return;
            }

            msg.SetReliable(filter.IsReliable());

            foreach (var client in Clients)
            {
                if (!client.IsSpawned())
                {
                    continue;
                }

                if (!client.NetChannel.SendNetMsg(msg))
                {
                    if (msg.IsReliable())
                    {
                        Out.Warning("BaseServer.BroadcastMessage: Reliable filter message overflow for client {0}", client.GetClientName());
                    }
                }
            }
        }
예제 #2
0
        public bool SendNetMsg(INetMessage msg, bool forceReliable = false)
        {
            if (_remoteAddress == null)
            {
                return(true);
            }

            var stream = StreamUnreliable;

            if (msg.IsReliable() || forceReliable)
            {
                stream = StreamReliable;
            }

            return(msg.WriteToBuffer(stream));
        }