Re: cvs socket extension
| From: | Markus Fischer | Date: | Mon, 23 Jul 2001 15:16:13 +0000 |
| Subject: | Re: cvs socket extension | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-60764@lists.php.net to get a copy of this message | ||
On Mon, Jul 23, 2001 at 07:20:34AM -0700, Chris Vandomelen wrote :
> > > >
> > > >socket_select(0x7fffffff, $fd_set, 0, 0, 0, 0);
> > >
> > > we can add a support function which return's the php_socket->socket integer.
> >
> > Glad someone came up with this.
> >
> > 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 ?
> >
> > Or are there good reasons to let the user specify the value on
> > its own ?
> >
>
> In theory, the user isn't going to be specifying sockets that aren't
> accessible as resources.
>
> 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 ?
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.
Maybe we should just stick to the single function which in
addition returns the handle of the socket itself.
- Markus