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? ?
黄舟2017-05-17 10:02:58
This tcp layer can no longer be sensed. Since the server has no heartbeat, it can only be sensed the next time there is data interaction
黄舟2017-05-17 10:02:58
Without heartbeat detection, if you want to sense data regularly, you can only wait for the next data interaction to sense it.