WorldServer.WorldClient.Send C# (CSharp) Method

Send() public method

public Send ( PacketOut packet ) : void
packet PacketOut
return void
        public void Send(PacketOut packet)
        {
            Console.Write("Sent:");
            for (int i = 0; i < packet.ToArray().Length; i++) Console.Write(" " + packet.ToArray()[i]);
            Console.WriteLine();
            byte[] toSend = Crypto.Encrypt(packet);
            MemoryStream tcpOut = new MemoryStream();
            tcpOut.WriteByte((Byte)((toSend.Length & 0xffff) & 0xff));
            tcpOut.WriteByte((Byte)((toSend.Length & 0xffff) >> 8));
            tcpOut.WriteByte((Byte)((toSend.Length >> 16) & 0xff));
            tcpOut.WriteByte((Byte)(toSend.Length >> 24));
            tcpOut.Write(toSend, 4, toSend.Length - 4);
            SendTCP(tcpOut.ToArray());
            tcpOut.Dispose();
            toSend = null;
        }