Ejemplo n.º 1
0
 public void Send(Packet packet)
 {
     if (tcpClient.Connected)
     {
         byte[] data = Encoding.UTF8.GetBytes(PacketEncryption.EncryptPacket(packet, password));
         networkStream.Write(data, 0, data.Length);
     }
 }
Ejemplo n.º 2
0
        private void BackgroundSender_DoWork(Packet packet, Client client)
        {
            if (client.socket.Connected)
            {
                Socket socket         = client.socket;
                string crypted_packet = PacketEncryption.EncryptPacket(packet, password);

                if (!string.IsNullOrEmpty(crypted_packet))
                {
                    byte[] data = Encoding.UTF8.GetBytes(PacketEncryption.EncryptPacket(packet, password));
                    socket.Send(data);
                }
            }
        }