public void Send(PacketOut packet) { byte[] toSend = ECrypt.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; }