Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 May 2005 00:52:36 -0400
From:      "J.R. Oldroyd" <jr@opal.com>
To:        "J.R. Oldroyd" <fbsd@opal.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: async connect problem
Message-ID:  <20050506045236.GQ51983@linwhf.opal.com>
In-Reply-To: <20050506030841.GL51983@linwhf.opal.com>
References:  <20050506023318.GK51983@linwhf.opal.com> <20050505193739.Y36831@thought.holo.org> <20050506030841.GL51983@linwhf.opal.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050506045236.GQ51983>