httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Dean Gaudet)
Subject Re: Scoreboard and sites...
Date Mon, 04 Mar 1996 18:42:33 GMT
In article <> you write:
>_both_ children might return from select() and call accept(). One
>child will receive the connection, and the other will be stuck waiting
>for another connection on port 80 _only_.

You can mark the sockets as non-blocking (in one of the three or four
different ways depending on the architecture) and then the accept()
will return immediately (with one of two different errnos).

I've found fcntl(s, F_SETFL, FNDELAY) to be the most portable method of
marking something non-blocking (should work on all the "modern" unixes,
and on dynix/ptx which is sysvr3).  Look for O_NONBLOCK, or FNONBLK on
some systems instead of FNDELAY.  Also look for ioctl() with FIONBIO.
The most portable method of checking for the would-block errnos is:

    if( errno = EWOULDBLOCK || errno == EAGAIN ) {
	/* call would block */

It still won't be optimal, but you won't have a child waiting on one
port only.


View raw message