Date: Fri, 6 May 2005 14:34:16 +1000 From: "anon:*:anon" <d4rkstorm@gmail.com> To: freebsd-current@freebsd.org Subject: Re: async connect problem Message-ID: <245f0df10505052134124cc6b7@mail.gmail.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
Subsequent code to check the socket's status, something like:
int n;
socklen_t intsize = sizeof(int);
getsockopt(f, SOL_SOCKET, SO_ERROR, (void*)&n, &intsize);
if (n) ...
which works (with suitable cast adjustments) on Solaris, Linux,
Darwin, and yes, even on Windows, doesn't work here.
inline bool sockreq() { return bSocketsRunning; }
it could be a simple script, or it could become a socket array of
nightmares.. but it is no oubt a god idea to always check the sockets.
On 5/6/05, J.R. Oldroyd <fbsd@opal.com> 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.
>
> Perhaps I should ask a different question.
>
> Subsequent code to check the socket's status, something like:
>
> int n;
> socklen_t intsize = sizeof(int);
>
> getsockopt(f, SOL_SOCKET, SO_ERROR, (void*)&n, &intsize);
> if (n) ...
>
> which works (with suitable cast adjustments) on Solaris, Linux,
> Darwin, and yes, even on Windows, doesn't work here.
>
> I have an alternative test that uses getpeername(), but I'm surprised
> at the difference in behavior.
>
> -jr
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>
--
------------------------------------------
Signature Here
------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?245f0df10505052134124cc6b7>
