Пример #1
0
 public void Send(Packet p)
 {
     lock (DataToSendQueue)
     {
         DataToSendQueue.Enqueue(p.Serialize());
     }
     //socket.SendAsync(p.Serialize());
 }
Пример #2
0
        public void Send(Packet packet)
        {
            Counter.AddTick("pps_out");
            //Counter.AddTick("average_pps_out", Counter.GetAverageValue("pps_out"));

            if (socket == null)
                return;

            socket.Send(packet.Serialize());
        }
Пример #3
0
 public void Send(Packet p)
 {
     // To everyone
     byte[] data = p.Serialize();
     foreach (SocketComm s in Clients.Values)
     {
         if (s != null)
             s.Send(data);
     }
 }
Пример #4
0
        public void SendToAllButOne(Packet p, int id)
        {
            // Avoid the Specified id

            foreach (ClientInfoSocket s in Clients.Values)
            {
                if (s == null)
                    continue;
                if (s.ClientID == id)
                    continue;
                s.Send(p.Serialize());
            }
        }
Пример #5
0
 public void Send(Packet p, int id)
 {
     // To Specific id
     ClientInfoSocket s;
     if(Clients.TryGetValue(id, out s))
     {
         if(s != null)
             s.Send(p.Serialize());
     }
 }