Answer the question
In order to leave comments, you need to log in
How to set connection timeout to server, socket, java?
There is a client, everything connects, but if the server is turned off or the IP address has changed, it sees it waiting indefinitely. How to set the time to wait for a response from the server?
Answer the question
In order to leave comments, you need to log in
From documentation :
Connects this socket to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.
endpoint - the SocketAddress
timeout - the timeout value to be used in milliseconds.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question