如何使用Netty 4暂停和继续阅读? [英] How to pause and resume reading with Netty 4?
本文介绍了如何使用Netty 4暂停和继续阅读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Netty 3中我们可以做到:
In Netty 3 we can do:
Channel.setReadable(false);
Channel.setReadable(true);
我读过: http://netty.io/news/2012/09 /13/4-0-0-alpha4.html
But with the latest Netty 4 version (4.0.17, http://netty.io/news/2014/02/25/4-0-17-Final.html), this code is invalid because there's no ChannelHandlerContext#readable
:
serverChannel.pipeline().firstContext().readable(false);
serverChannel.pipeline().firstContext().readable(true);
推荐答案
用于暂停:
channel.config.setAutoRead(false)
并继续:
channel.config.setAutoRead(true)
这篇关于如何使用Netty 4暂停和继续阅读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文