C# Class DotNetty.Handlers.Timeout.ReadTimeoutHandler

Raises a ReadTimeoutException when no data was read within a certain period of time.
 The connection is closed when there is no inbound traffic for 30 seconds.   var bootstrap = new DotNetty.Transport.Bootstrapping.ServerBootstrap(); bootstrap.ChildHandler(new ActionChannelInitializer(channel => { IChannelPipeline pipeline = channel.Pipeline; pipeline.AddLast("readTimeoutHandler", new ReadTimeoutHandler(30); pipeline.AddLast("myHandler", new MyHandler()); }   public class MyHandler : ChannelDuplexHandler { public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) { if(exception is ReadTimeoutException) { // do somethind } else { base.ExceptionCaught(context, cause); } } }   WriteTimeoutHandler IdleStateHandler                            
Inheritance: ChannelHandlerAdapter
显示文件 Open project: cdy816/mars

Public Methods

Method Description
ReadTimeoutHandler ( TimeSpan timeout ) : System

Initializes a new instance of the DotNetty.Handlers.Timeout.ReadTimeoutHandler class.

ReadTimeoutHandler ( int timeoutSeconds ) : System

Initializes a new instance of the DotNetty.Handlers.Timeout.ReadTimeoutHandler class.

Protected Methods

Method Description
ChannelIdle ( IChannelHandlerContext context, DotNetty.Handlers.Timeout.IdleStateEvent stateEvent ) : void
ReadTimedOut ( IChannelHandlerContext context ) : void

Is called when a read timeout was detected.

Method Details

ChannelIdle() protected method

protected ChannelIdle ( IChannelHandlerContext context, DotNetty.Handlers.Timeout.IdleStateEvent stateEvent ) : void
context IChannelHandlerContext
stateEvent DotNetty.Handlers.Timeout.IdleStateEvent
return void

ReadTimedOut() protected method

Is called when a read timeout was detected.
protected ReadTimedOut ( IChannelHandlerContext context ) : void
context IChannelHandlerContext Context.
return void

ReadTimeoutHandler() public method

Initializes a new instance of the DotNetty.Handlers.Timeout.ReadTimeoutHandler class.
public ReadTimeoutHandler ( TimeSpan timeout ) : System
timeout TimeSpan Timeout.
return System

ReadTimeoutHandler() public method

Initializes a new instance of the DotNetty.Handlers.Timeout.ReadTimeoutHandler class.
public ReadTimeoutHandler ( int timeoutSeconds ) : System
timeoutSeconds int Timeout in seconds.
return System