java - Detecting client disconnect in tomcat servlet? -


how can detect client side of tomcat servlet request has disconnected? i've read should response.getoutputstream().print(), response.getoutputstream().flush() , catch ioexception, there way can detect without writing data?

edit:

the servlet sends out data stream doesn't end, doesn't have data flowing through (it's stream of real time events). need detect when client disconnects because have cleanup have @ point (resources release, etcetera). if have httpservletrequest available, trying read throw ioexception if client disconnects?

is there way can detect without writing data?

no because there isn't way in tcp/ip detect without writing data.

don't worry it. complete request actions , write response. if client has disappeared, cause ioexception: connection reset, thrown servlet container. nothing have that.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -