Exemplo n.º 1
0
        public override bool Pack(ref UdpBitStream stream, ref object o)
        {
            // cast to string and get bytes
            string msg = (string)o;

            byte[] bytes = Encoding.UTF8.GetBytes(msg);

            // write length and bytes into buffer
            stream.WriteInt(bytes.Length);
            stream.WriteByteArray(bytes);

            return(true);
        }