ECONNREFUSED error starting up socket

John Lupien lupienj at hpwadac.hp.com
Sat Nov 10 02:57:36 AEST 1990


When I try to connect to a socket, I sometimes get ECONNREFUSED even
though there is no activity on the socket. Usually this happens after
having used the same socket during the login session, but every now and then
it happens even on the first use.

The socket options I am setting (both sides) are:

SO_KEEPALIVE
SO_RCVBUF = SO_SNDBUF = 24Kb
SO_REUSEADDR
SO_DONTLINGER

On the receiving side of the call, the socket is bound to a specified port
and "INADDR_ANY". The "listen" does not indicate an error.
On the calling side, the "connect" is made specifying the host address
and port number for the listener.

Most of the time this works fine, but when it fails it is quite persistent
unless I log out and start over, in which case it usually works fine again.

Is there something obvious that I'm doing wrong? Is there something I
can do to assure that the listener side is really ready to accept connections?
Respond by e-mail if you like.

---
John R. Lupien
lupienj at hpwarq.hp.com



More information about the Comp.unix.internals mailing list