This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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
jQuery in Action, 3rd edition