![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
粘包
_自由之子_
这个作者很懒,什么都没留下…
展开
-
Netty解决粘包问题(1) 自定义分隔符
见如下代码Client.javaimport io.netty.bootstrap.Bootstrap;import io.netty.buffer.ByteBuf;import io.netty.buffer.Unpooled;import io.netty.channel.ChannelFuture;import io.netty.channel.ChannelInitializer;原创 2016-08-30 21:37:57 · 1967 阅读 · 4 评论 -
Netty解决粘包问题(2) 定长填充
第二种解决粘包的方案,就是每次发送固定长度的数据包,如果长度不够,那就用空字符串填充import java.nio.ByteBuffer;import io.netty.bootstrap.ServerBootstrap;import io.netty.buffer.ByteBuf;import io.netty.buffer.Unpooled;import io.netty.channel.原创 2016-08-31 20:38:19 · 487 阅读 · 0 评论