Messages in this thread | | | Date | Sat, 27 Jun 1998 17:20:59 +1000 | From | Richard.Gooch@atnf ... | Subject | connect(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
| |