public byte[] toBuffer() { byte[] buf = new byte[_dat.Count + 2]; bw.writeUInt16(buf, 0, (ushort)(_dat.Count + 2)); _dat.CopyTo(buf, 2); buf [3] |= (byte)0x80; //protocol buffer return(buf); }