Detect "interrupted" connections

I wrote a HTTP-chatserver with NIO and search for a solution to detect, if the PC from a user is crashed or his ADSL connection will be-reconnected. In this case channel.read() does not return -1 and throws no exception, channel.write(),

too.

My idea, i could send a ping to the users pc...but this solution is not the best, i think. Any ideas?

TheChief

[379 byte] By [TheChiefa] at [2007-10-3 3:54:32]
# 1
Eventually channel.write() will throw a SocketException.I don't regard ping() or isReachable() as much of a solution myself, but YMMV.
ejpa at 2007-7-14 21:52:31 > top of Java-index,Archived Forums,Socket Programming...
# 2
The chat protocol could use a keep-alive packet sent between the client and server every 5 seconds or so.When a client / server does not send/receieve the keep-alive packet - then the link is dead.
watertownjordana at 2007-7-14 21:52:31 > top of Java-index,Archived Forums,Socket Programming...
# 3
Yes, a keep-alive i send every minute. That means, i only send <!--Keep-alive--> to the browser, that the connection will not be closed from the browser side..But it seems, that it throws no exception, too. But i will check my routines, maybe i'll find
TheChiefa at 2007-7-14 21:52:31 > top of Java-index,Archived Forums,Socket Programming...