| | |
| | | * 当客户端主动断开服务端的链接后,这个通道就是不活跃的。也就是说客户端与服务端的关闭了通信通道并且不可以传输数据 |
| | | */ |
| | | public void channelInactive(ChannelHandlerContext ctx) throws Exception { |
| | | System.out.println("客户端与服务端通道-关闭:" + ctx.channel().localAddress() + "channelInactive"); |
| | | log.error("客户端与服务端通道-关闭:" + ctx.channel().localAddress() + "channelInactive"); |
| | | } |
| | | |
| | | @Override |
| | | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { |
| | | ctx.close(); |
| | | System.out.println("异常退出:" + cause.getMessage()); |
| | | log.error("异常退出:" + cause.getMessage()); |
| | | } |
| | | |
| | | public void write(ChannelHandlerContext ctx, String mess) throws Exception { |