当前位置:Gxlcms > 数据库问题 > LengthFieldBasedFrameDecoder 参数说明

LengthFieldBasedFrameDecoder 参数说明

时间:2021-07-01 10:21:17 帮助过:6人阅读

LengthFieldBasedFrameDecoder 参数说明
举例
数据包格式为
body长度(4个)+14个字节的版本说明(字符串)+body
那么LengthFieldBasedFrameDecoder的参数为

new LengthFieldBasedFrameDecoder1(ByteOrder.LittleEndian, int.MaxValue, 0, 4, 14, 18, true)

他的构造函数是

LengthFieldBasedFrameDecoder1(ByteOrder byteOrder, int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, bool failFast)


lengthFieldOffset=0,即长度的偏移字节为零。放在首字节。
lengthFieldLength=4,长度4个字节。
lengthAdjustment=14,即修正字节是14,也就是包头长度18-4(4个包头长度),body长度本身不包含包头长度,所以用来计算实际帧长度的左右。

initialBytesToStrip=18,即跳过包头18个字节。直接读取body.如果要验证包头的参数。则不能跳过

LengthFieldBasedFrameDecoder 参数说明

标签:order by   长度   说明   frame   int   左右   little   body   ini   

人气教程排行