how to set the timeout for the operation? my question is i have send a request to the server and waiting for resonse. how to come out from that and continuew my operation if the server is not responding.
How do you prevent Java from hanging on socket = new Socket(addr, port) line if the machine on the other end is not responding?
in my case i am successfully connected with servre with the socket and waiting for some response from the server if the server is failed OR some other problem for the server i should come out ..how this will possible chennarao
I guess since you are creating a TCP/IP connection , if any one of the end points breaks down the connection will be broken automatically giving you an Exception.
So if your server crashed while u were waiting for some data from the server, your connection will be broken. So you need only worry about how to handle the exception. Does that make sense???
Ernest Friedman-Hill
,
author and iconoclast
staff