Detecting client disconnect in tomcat servlet?

is there a way I can detect this
without writing any data?

No because there isn’t a way in TCP/IP to detect it without writing any data.

Don’t worry about it. Just complete the request actions and write the response. If the client has disappeared, that will cause an IOException: connection reset, which will be thrown into the servlet container. Nothing you have to do about that.

Leave a Comment