public void sendreliable(ref byte[] buffer) { int channelidsize = sizeof(ChannelidType); byte[] temparray = new byte[buffer.Length + channelidsize]; Array.ConstrainedCopy(ByteArraytoChannelidType.Serialize(mchannelid), 0, temparray, 0, channelidsize); Array.ConstrainedCopy(buffer, 0, temparray, channelidsize, buffer.Length); mchannelmanager.sendreliable(ref temparray); }
void getvalidedata(ref byte[] buffer, out byte[] validebuffer, out String str1, out ChannelidType id) { id = ByteArraytoChannelidType.DeSerialize(ref buffer); int idsize = sizeof(ChannelidType); Int32 playloadsize = buffer.Length - idsize; validebuffer = new byte[playloadsize]; Array.ConstrainedCopy(buffer, idsize, validebuffer, 0, playloadsize); #if UTF16 var str = System.Text.Encoding.Unicode.GetString(validebuffer); #else var str = System.Text.Encoding.UTF8.GetString(realdata); #endif str1 = str; }