From: newsham AT lava DOT net (Tim Newsham) Subject: socketpair bug 7 May 1998 06:07:36 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com Hi, It looks like socketpair() doesn't properly handle growing the file descriptor table. If you write a loop to open socketpairs, it quits after 14 pairs. Test program included below. I implemented my own socketpair function and I'm noticing some strange results. It appears that connect() back to localhost occasionally reports EADDRINUSE. To make the function more robust, I made it try the whole operation several times (currently 3 times max). Even with retries, it occasionally errors out. I can't imagine why winsock would behave this way, I'm using dynamic ports for each endpoint and not setting the reuse-address option, so there should be no chance of getting the same port on one endpoint, let alone on both endpoints. Very strange. Strike up another point to winsock. Tim N. /* this will fail after the 14th pair. I don' think cygwin is * growing the dynamic fd table properly in this case */ #include #include #include #include int main() { int s[2 * 100], *pair; int i; memset(s, 0xff, sizeof s); for(i = 0; i < 100; i++) { pair = &s[i * 2]; if(socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) { printf("error at %d: %s\n", i, strerror(errno)); } else { printf("%d %d\n", pair[0], pair[1]); } } for(i = 0; i < 100; i++) { pair = &s[i * 2]; close(pair[0]); close(pair[1]); } return 0; } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".