Exemple #1
0
        public void SendPacket(S_Packet packet)
        {
            lock (this)
            {
                packet.Write();
                byte[] pck = packet.ToByteArray();

                List <Byte> FullPacket = new List <Byte>();
                FullPacket.AddRange(BitConverter.GetBytes((int)(pck.Length)));
                FullPacket.AddRange(pck);
                try
                {
                    Client.Send(FullPacket.ToArray());
                }
                catch { }
            }
        }
Exemple #2
0
 public void SendPacket(S_Packet packet)
 {
     try
     {
         packet.Write();
         byte[]      buffer = packet.ToByteArray();
         byte        ID     = buffer[0];
         List <byte> Packet = new List <byte>();
         Packet.AddRange(BitConverter.GetBytes((int)(buffer.Length)));
         Packet.AddRange(buffer);
         client.Send(Packet.ToArray());
         Trafic.ChangeTrafic(Trafic.TraficType.Sent, Packet.Count);
     }
     catch
     {
     }
 }