java - How does the Netty server detect that the client network is abnormally disconnected? ?
PHP中文网
PHP中文网 2017-05-17 10:00:58
0
2
913

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? ?

PHP中文网
PHP中文网

认证高级PHP讲师

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!