lkml.org 
[lkml]   [1998]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectconnect(2)/accept(2) oddity
  Hi, all. I've come across what appears to be some strange behaviour
in the Linux connect(2) and accept(2) implementation. I have a server
that basically does:

sock = socket ();
bind (sock);
listen (sock);
poll (all my FDs);
IF input ready on sock, newfd = accept (sock), ++conn_count;
IF first time input ready on a newfd, print conn_count;

And my client does this:
DO 1000 times
fd[i] = connect ();
write (fd[999]);

Now what is happening is that the server is printing conn_count before
it reaches 1000. The client is run on my dual-PPro. If I run the
server also on my dual PPro (and use Unix sockets), conn_count = 900+
when it prints. If I run the server on a P100, conn_count = 300+.

If I have the server write a byte right after accept(2) and the client
reads it before doing the next connect(2), then conn_count is always
printed when it is 1000.

This seems strange to me. It appears connect(2) is returning before
the accept(2) completes. Am I missing something here, or is Linux
behaving strangely?

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.047 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site