报文格式修改

master
rszn 4 months ago
parent 35e279276a
commit b2f365f9f2

@ -32,7 +32,7 @@ public class Decoder : ByteToMessageDecoder
Log.Info($"receive {BitUtls.BytesToHexStr(bytes)}");
int id = BitConverter.ToInt32(new byte[] { bytes[4], bytes[3], bytes[2], bytes[1] }, 0);
int id = BitConverter.ToInt32(new byte[] { bytes[3], bytes[2], bytes[1], bytes[0] }, 0);
Log.Info(
$"receive id={id} {BitUtls.BytesToHexStr(BitConverter.GetBytes(0x1882D0F3))} {BitUtls.BytesToHexStr(BitConverter.GetBytes(4090528280))}");
BaseMsg baseMsg = id switch

@ -19,6 +19,8 @@ public class Encoder : MessageToByteEncoder<BaseMsg>
protected override void Encode(IChannelHandlerContext context, BaseMsg obj, IByteBuffer output)
{
byte[] bytes = obj.ToBytes();
output.WriteBytes(bytes);
byte[] result =
{ 0, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], 0, 0, 0, 0 };
output.WriteBytes(result);
}
}

Loading…
Cancel
Save