Пример #1
0
        public void SendPacket(SendBasePacket packet)
        {
            lock (this)
            {
                packet.Write();
                byte[] pck = packet.ToByteArray();

                byte PacketId = pck[0];
                pck = CryptEngine.Crypt(pck, NetworkKey);

                List <Byte> FullPacket = new List <Byte>();
                FullPacket.AddRange(BitConverter.GetBytes((short)(pck.Length + 2))); //+2 Packet Length
                FullPacket.AddRange(pck);
                try { _socket.Send(FullPacket.ToArray()); } catch { }
                settings.SendedPackets++;
            }
        }
Пример #2
0
 public bool SendPacket(SendBasePacket packet)
 {
     lock (this)
     {
         try
         {
             packet.Write();
             byte[]      pck        = CryptEngine.Crypt(packet.ToByteArray());
             List <Byte> FullPacket = new List <Byte>();
             FullPacket.AddRange(BitConverter.GetBytes((short)(pck.Length + 2))); //+2 Packet Length
             FullPacket.AddRange(pck);                                            //Packet
             _client.Send(FullPacket.ToArray());
         }
         catch
         {
             return(false);
         }
         return(true);
     }
 }
Пример #3
0
        public void SendPacket(SendBasePacket packet)
        {
            lock (this)
            {
                packet.Write();
                byte[] pck = CryptEngine.Crypt(packet.ToByteArray());

                if (packet.Length > 60000)
                {
                    return;
                }

                List <Byte> FullPacket = new List <Byte>();
                FullPacket.AddRange(BitConverter.GetBytes((short)(pck.Length + 2))); //+2 Packet Length
                FullPacket.AddRange(pck);                                            //Packet
                try
                {
                    _client.Send(FullPacket.ToArray());
                } catch {}
            }
        }