On Mon, Jul 23, 2001 at 05:16:13PM +0200, Markus Fischer wrote:
> On Mon, Jul 23, 2001 at 07:20:34AM -0700, Chris Vandomelen wrote : 
> > > Since socket_select() always wants highest +1, couldn't this be
> > > implemented into socket_select() to go through all socket sets
> > > and get the number itself ?

Why all sets? Isn't it enough to use max for the set that got passed to
socket_select()?

> > The best way around this (IMHO) is to define a php_fd_set something like:
> > 
> > struct php_fd_set {
> >     fd_set the_set;
> >     int    max_fd;
> > };
> 
> Btw, is this really enough information ?

Yes, that's my doubt as well, I'm not sure how much of a problem
it is though.

> Consider this:
> You use FD_SET() to add a socket to the set (you just bump_up
> max_fd if socket > max_Fd)
> 
> But when using FD_CLR() to remove a socket how do we know
> which socket in this set has the highest number now
> and whats the number anyway (beside 42) then ?
> 
> Seems like we need a list for every set containing the current
> socket numbers in the set (if I'm not totally wrong :) because
> AFAIK if you don't keep a list of the numbers of a set without
> brute force you can't retrieve the list.

In order to be portable we can't inspect the actual bits in the
set I think, so the only way I see is to have a list of the
numbers. So for every call to socket_fd_set(), you add to the
list, and in socket_fd_clear() you remove. In order to not look
for max every time you call select, you might also store the
max somewhere maybe. I think you should have one such list per
set, and create an empty list in socket_fd_alloc().

Stig

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to