Posts Tagged ‘timeout’

Socket: Connection Refused – No Timeout

May 18, 2014

Some one has asked me: Your server failed connecting to third party server, it retries and immediately gets a response: Connection Refused. Why is not there a time-out?

Here is capture from a log:

DEBUG:  Creating a new socket to '10.38.6.62:1119'...
ERROR:  Failed reconnecting: Connection refused
DEBUG:  Creating a new socket to '10.38.6.62:1119'...
ERROR:  Error - Connection refused [ socket = null ] Going to retry for the '3' time.
DEBUG:  Creating a new socket to '10.38.6.62:1119'...
ERROR:  Failed reconnecting: Connection refused
ERROR:  Could not communicate with 10.38.6.62:1119. '3' retries are ended. Total request time '11' ms

The answer is:

Connection Refused means that there is no program at the other end of the connection that listens to incoming connections. Connection time-outs are for the cases where there is no response at all. A connection refusal is a valid response, so the time-out doesn’t apply in such case.