more fun with sockets

From: Carter T. Shock (ctso@umiacs.UMD.EDU)
Date: 08/03/95


Here's an interesting bit of trivia...
Playing with circle 2.2....

It seems that each player socket is set to non-blocking I/O while
the mother connection is not. Ever notice that occasionally the game
comes to a screaming halt while someone is trying to connect?

So... if accept() is called on a socket with blocking I/O that has had
listen() called, then accept() blocks until a connection is present
on the socket. When called on a non-blocking socket, accept() returns
a non-fatal error if no new connection is in the queue. So...
if you select() the mother connection, and something goes haywire
(monster lag.. whatever) and the new connect isn't on the queue, then
the accept() call in new_connection() blocks until someone tries to enter
the game. Meanwhile the game sits idle....

Do I have this right, or is there another explanation? I guess the big
question is why the mother socket isn't set to nonblocking. Would this break
anything?

	-Todd
The Void @ rosebud.umiacs.umd.edu 4000



This archive was generated by hypermail 2b30 : 12/18/00 PST