Netty ChannelRead方法没有被调用 [英] Netty ChannelRead method is not getting invoked

查看:2366
本文介绍了Netty ChannelRead方法没有被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的netty示例中,如果我将ServerBootstrap的AUTO_READ选项配置为false.然后在我相应的处理程序中,从不调用ChannelRead方法,仅在调用ChannelActive.但是,如果我删除了AUTO_READ选项,则一切正常,两个方法都被调用.

Hi In my netty sample if I configure my ServerBootstrap with AUTO_READ option as false. Then in my corresponding handler ChannelRead method is never getting invoked, only ChannelActive is getting invoked. However if I remove the AUTO_READ option then everything is working and both the methods are getting invoked.

我在这里错过了一些非常基本的东西吗?

Am I missing something very basic here?

推荐答案

AUTO_READ设置为false时,除非您显式调用channel.read();

When AUTO_READ is set to false, no read operation occurs until you explicitely call channel.read();

将其设置为true时,将自动允许读取并传递给处理程序.

When you set it to true, then read are automatically allowed and passed up to the handlers.

请参见此处

这篇关于Netty ChannelRead方法没有被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆