The client is javaswing netty, and the server uses Springnetty.
When the server does not use heartbeat detection, if the client suddenly unplugs the network cable and disconnects from the network (note that this is not a client program shutdown, but only an abnormal network disconnection), the server-side Handler
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close(); //
}
The method did not receive the exception information, so how to detect this? ?
这个tcp层就已经无法感知了,既然服务端没有心跳,那就只能等下次有数据交互的时候来感知了
不使用心跳检测,定期数据感知的话,只能等着下次数据交互的时候感知了。