On Mon, Jul 23, 2001 at 11:15:49PM +0200, Stig Venaas wrote : 
> 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().

Chris mentioned something that its not needed to restore the last
highest value for the max_fd if you drop the current highest one.

This makes me wondering why we not ever pass something like
0xffffffff to select() [of course there is some legal reason not
to do this, i'm just curious now].

One the other hand, Daniel [afaik??] suggested to let the user
retrieve the handle id for a socket and calculate the hightest
value on its own. Something like

        $fd = socket_get_fd( $socket);

comes into my mind.

The first one would be more nice for the users while the later is
much less programming effort :-)

I'm just wondering if there can be ever any drawback if we don't
let the user specify the first parameter to the select() call.

As I'm not an expert I can't tell.


Markus Fischer,  http://guru.josefine.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0

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