Re: async connect problem

From: J.R. Oldroyd <jr_at_opal.com>
Date: Fri, 6 May 2005 00:52:36 -0400
On May 05, 23:08, J.R. Oldroyd wrote:
> On May 05, 19:39, Brian Buchanan wrote:
> > On Thu, 5 May 2005, J.R. Oldroyd wrote:
> > 
> > >Isn't our behaviour wrong...
> > >
> > >On 6-current, the program below prints:
> > >	connect: Connection refused
> > >
> > >Shouldn't it print:
> > >	connect: Operation now in progress
> > 
> > No, that's the correct behavior.  The system was able to satisfy your 
> > request without blocking because you were attempting a connection to the 
> > loopback, so connect() returned immediately with errno == ECONNREFUSED.
> > 
> > - Brian
> 
> You are correct, it does return EINPROGRESS when using a non-loopback
> address.
> 

Even more surprising: on further investigation, running that program
with 127.0.0.1 or my own Ethernet address is inconsistent: it mostly
returns ECONNREFUSED but it does return EINPROGRESS occasionally
too.  In several runs of 100 invocations each, I'm seeing anything
from 0% to 18% of the results be EINPROGRESS - that's using the
same local IP and port every time.

Running it with the IP address of another host returns EINPROGRESS
100% of the time.

The getsockopt() call does appear to succeed in those cases where
EINPROGRESS is returned.

Given the inconsistent behavior between the local and non-local
addresses and the self-inconsistent behavior in the local case, it
seems that we may have an issue here.

	-jr

PS: I meant getsockopt(s, ...) before.  The "f" was a typo.
Received on Fri May 06 2005 - 03:16:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:34 UTC