예제 #1
0
        // Envoi un packet
        // Send packet
        public void SendTCP(PacketOut packet)
        {
            //Fix the packet size
            packet.WritePacketLength();
            packet = Crypt(packet);

            //Get the packet buffer
            byte[] buf = packet.ToArray(); //packet.WritePacketLength sets the Capacity

            //Send the buffer
            SendTCP(buf);
        }
예제 #2
0
        public void SendToAll(PacketOut Packet)
        {
            Packet.WritePacketLength();

            lock (Clients.SyncRoot)
            {
                for (int i = 0; i < Clients.Length; ++i)
                {
                    if (Clients[i] != null)
                    {
                        Clients[i].SendTCP(Packet.ToArray());
                    }
                }
            }
        }