C# Class DotNettyServer.DotNetty.NettyServerChannelHandler

因为服务器只需要响应传入的消息,所以只需要实现ChannelHandlerAdapter就可以了
Inheritance: SimpleChannelInboundHandler Mostra file Open project: dotnet9/DotNettyDemo

Public Methods

Method Description
ChannelActive ( IChannelHandlerContext context ) : void

通道激活

ChannelInactive ( IChannelHandlerContext context ) : void

断开连接

ChannelReadComplete ( IChannelHandlerContext context ) : void

消息读取完成

ChannelRegistered ( IChannelHandlerContext context ) : void

注册通道

ChannelUnregistered ( IChannelHandlerContext context ) : void

注销通道

ExceptionCaught ( IChannelHandlerContext context, Exception exception ) : void
SendData ( testEvent ) : void

发送数据到客户端

Protected Methods

Method Description
ChannelRead0 ( IChannelHandlerContext ctx, msg ) : void

收到客户端回应

Method Details

ChannelActive() public method

通道激活
public ChannelActive ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ChannelInactive() public method

断开连接
public ChannelInactive ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ChannelRead0() protected method

收到客户端回应
protected ChannelRead0 ( IChannelHandlerContext ctx, msg ) : void
ctx IChannelHandlerContext
return void

ChannelReadComplete() public method

消息读取完成
public ChannelReadComplete ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ChannelRegistered() public method

注册通道
public ChannelRegistered ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ChannelUnregistered() public method

注销通道
public ChannelUnregistered ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ExceptionCaught() public method

public ExceptionCaught ( IChannelHandlerContext context, Exception exception ) : void
context IChannelHandlerContext
exception Exception
return void

SendData() public method

发送数据到客户端
public SendData ( testEvent ) : void
return void