Re: cvs socket extension
| From: | Chris Vandomelen | Date: | Mon, 23 Jul 2001 14:20:34 +0000 |
| Subject: | Re: cvs socket extension | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-60758@lists.php.net to get a copy of this message | ||
> > >
> > >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;
};
Then, whenver someone calls fd_set() or fd_zero(), change
php_fd_set.max_fd appropriately as well as updating php_fd_set.the_set,
and in socket_select(), check all of the max_fd values.
Removing the first arg to socket_select(), if that's implemented, wouldn't
be a bad idea either.
Chris