netty 傳送 超過 1024 資料
自定義 decode 採用 LengthFieldBasedFrameDecoder
客戶端
Bootstrap b = new Bootstrap();
b.group(bossGroup)
.channel(NioSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast("ServerDecoder", new ClientDecoder());
}
})
.option(ChannelOption.SO_KEEPALIVE, true)
.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(65535));
.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(65535)); !!! 這句話是 關鍵