[MLton] Socket.connectNB on NetBSD

Stephen Weeks MLton@mlton.org
Tue, 18 Nov 2003 20:51:34 -0800


> No, I think you misunderstood me.  The point is that the connect can return
> -1 even if the connection will succeed.  The point is that given that the
> socket is non-blocking, it doesn't want to wait around to see if it will
> succeed.
> I think that if you do a connect, it can either return success or else
> failure with errno EAGAIN.  Then you can select on it (or loop, or what
> ever) and eventually it will return success.  The same if you are trying
> to connect on some socket that the machine is not listening on, but then
> replace success with failure with some errno other than EAGAIN.

I am still not understanding you.  The problem, as the kernel traces
show, is that the connect call on NetBSD and SunOS is returning 0,
while on Linux it is returning -1.  Since the connect cannot succeed,
I don't see how returning 0 should be allowed.