Results 1 to 2 of 2
Thread: Socket Timeout?
- 09-12-2009, 04:11 AM #1Member
- Join Date
- Jan 2009
- Rep Power
So I have a Server-Client application I am creating and heres my problem.
When the server disconnects, crashes, or a i shut it down (what I'm getting at, is its unexpected), the clients on the other end have no idea that the server has disappeared until sometime later.
I believe the clients find out at some point of a TimeOut but they do eventually find out. I want a creative way to check maybe every 15 seconds whether the server is still there. I've looked up and down the Socket api for methods I could use. For example, there is a method
But even after I close my server this method returns true for some while.
- 09-12-2009, 05:12 AM #2
If you look at the java api doc for the isConnected method() it says it
returns true if the socket successfully connected to a server
One way would to simply send a packet and see if the server responds every 15 seconds. if it doesn't respond then something is wrong.
- By pjmorce in forum Advanced JavaReplies: 5Last Post: 04-27-2010, 03:36 AM
- By email@example.com in forum NetworkingReplies: 3Last Post: 04-17-2009, 08:02 PM
- By nmbalaji in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 12-12-2008, 05:04 PM
- By byuu in forum Threads and SynchronizationReplies: 2Last Post: 05-27-2008, 10:05 PM