private void Send(BinaryMessage msg) { if (msg.Length > 255) { throw new AuthException("Message is too long (" + msg.Length + " bytes)"); } var bytes = new byte[msg.Length + 2]; bytes[0] = (byte)((msg.Length & 0xff00) >> 8); bytes[1] = (byte)(msg.Length & 0x00ff); Array.Copy(msg.GetData(), 0, bytes, 2, msg.Length); ctx.Write(bytes); }
private void Send(BinaryMessage message) { if (message.Length > 255) { throw new AuthException("Message is too long (" + message.Length + " bytes)"); } var bytes = new byte[message.Length + 2]; bytes[0] = message.Type; bytes[1] = (byte)message.Length; Array.Copy(message.GetData(), 0, bytes, 2, message.Length); ctx.Write(bytes); }