File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java Server Disconnect Detection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Server Disconnect Detection" Watch "Java Server Disconnect Detection" New topic

Java Server Disconnect Detection

johnny parker

Joined: Mar 21, 2012
Posts: 3


I've completed building my java chess server using blocking tcp sockets, everything works like a charm, but i am having troubles detecting disconnections and i have to do that for removing clients from connected clients list so users can log in again after..Chess client is an IOS application so app can go in background and i wont be able to send alive messages to server setting up a timer because timers doesnt work in background normally, meaning i cant set socket timeout on server because now i can receive moves and game can continue even after 5 minutes of background mode. So how can i detect a disconnection, without setting socket timeout, like when wifi goes off ? It doesn't throw any kind of exception even if i am sending heartbeats and writing to the socket every 30 seconds to clients, any ideas would be appreciated thank you.
I agree. Here's the link:
subject: Java Server Disconnect Detection
It's not a secret anymore!