0

netty 接收到的数据偶尔不完整?

 1 year ago
source link: https://www.v2ex.com/t/948273
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

netty 接收到的数据偶尔不完整?

  furaoo · 20 小时 1 分钟前 · 1259 次点击

最近在用 netty 开发服务器端,与 4g 设备进行通讯,但是遇到了接收报文偶尔出现不完整的情况, 如下红色方框,每 10 次问询,就会出现一次报文接收不完整的情况。出问题的报文被截断了。(非红框的日志打印的报文长度都正常) 但报文的长度是一样的。也就是说出问题的报文执行了 2 次 channelRead 方法,然后才执行 channelReadComplete 打印 信息接收完毕..... 。请教一下各位这方面的大佬,这是 tcp 拆包问题吗?

问题

这是我的 netty 配置: netty 启动类

这是 netty 启动类

这是自定义 ChannelInitializer 类

这是自定义 ChannelInitializer 类

这是自定义报文处理类

这是自定义报文处理类

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK