Results 1 to 2 of 2
Thread: Socket Timeout?
- 09-12-2009, 03:11 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 92
- Rep Power
- 0
Socket Timeout?
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
socket.isConnected()
But even after I close my server this method returns true for some while.
Any ideas?
- 09-12-2009, 04:12 AM #2
If you look at the java api doc for the isConnected method() it says it
I'm going to assume that once the socket has connected to the server it will continue to return true.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.
Similar Threads
-
Implement a timeout
By pjmorce in forum Advanced JavaReplies: 5Last Post: 04-27-2010, 02:36 AM -
append response to the request from Socket and write to another socket
By vaibhav_singh_vs@yahoo.co in forum NetworkingReplies: 3Last Post: 04-17-2009, 07:02 PM -
session timeout
By nmbalaji in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 12-12-2008, 04:04 PM -
Threads and Timeout in Socket Networking
By byuu in forum Threads and SynchronizationReplies: 2Last Post: 05-27-2008, 09:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks