{@code ChannelPipeline pipeline = ...; pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new FlowControlHandler()); pipeline.addLast(new MyExampleHandler()); class MyExampleHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(IChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { ctx.channel().config().setAutoRead(false); // The FlowControlHandler will hold any subsequent events that // were emitted by HttpObjectDecoder until auto reading is turned // back on or Channel#read() is being called. } } } }@see ChannelConfig#setAutoRead(bool)
true
if its the first idle event for the true
if this was the first event for the true
if first; otherwise, false
.Property | Meaning |
---|---|
readerIdleTime |
an 0 to disable.
|
writerIdleTime |
an 0 to disable. |
allIdleTime |
an 0 to disable. |
0
to disable.
an 0
to disable.
an 0
to disable.
bytes
should be taken into
consideration when assessing write idleness. The default is false
.
an true
if and only if the observeOutput
enabled and there has been an observed change in the
The connection is closed when there is no inbound traffic for 30 seconds.var bootstrap = new (); bootstrap.ChildHandler(new ActionChannelInitializer<ISocketChannel>(channel => { IChannelPipeline pipeline = channel.Pipeline; pipeline.AddLast("readTimeoutHandler", new (30); pipeline.AddLast("myHandler", new MyHandler()); } public class MyHandler : ChannelDuplexHandler { public override void ExceptionCaught( context, exception) { if(exception is ) { // do somethind } else { base.ExceptionCaught(context, cause); } } }