public override bool Pack(UdpStream stream, ref object o) { // cast to string and get bytes byte[] bytes = (byte[])(o); // write length and bytes into buffer stream.WriteInt(bytes.Length); stream.WriteByteArray(bytes); return(true); }
public override bool Pack(UdpStream 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; }
public override bool Pack(UdpStream 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); }