Subject: Linux
To: None <port-i386@NetBSD.ORG>
From: Nathaniel Daw <daw@cs.cmu.edu>
List: port-i386
Date: 01/17/1998 22:22:36
I did some testing on a Linux (2.0.32, glibc 6.0) box, and verified
the strange behavior with non-blocking connects that had been giving
us trouble with the JDK in emulation:

Unlike NetBSD, Linux will *not* return EISCONN for the *first* call to
connect on a nonblocking socket after the connection completes
(i.e. the second call to connect on a given socket). It does not seem
to care what address you pass.

Linux *will* return the error for the third and subsequent calls to
connect on noblocking sockets, and it *will* return the error for all
superfluous calls to connect on connected *blocking* sockets.

God knows why this is, and why the JDK seems to depend on it. The
socket works fine, even if you don't make the second call to connect.

Anyway, the patch recently posted is too liberal in suppressing
EISCONN -- it should only suppress it on nonblocking connects, and
that only once per socket. Given that this involves keeping state
(urgh), a good approximation might be to never return EISCONN on
nonblocking sockets.

I can't make & test a patch since my kernel sources are out of date
and scrambled by a misbehaving sup, but hopefully this is enough
information to get it into the tree anyway.

Enjoy.

nd