Re: libxml bundling
| From: | Marcel Beerta | Date: | Sun, 02 Jun 2002 09:02:25 +0000 |
| Subject: | Re: libxml bundling | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84687@lists.php.net to get a copy of this message | ||
> Andrei solved it. It is because socket_select() mangles the passed
arrays
> so when you re-enter the call with the mangled $read array you are now
> only checking the sockets that happened to trigger the first time
through.
>
> It means you actually have to do:
>
> $read = array($sock1,$sock2);
> $copy = $read;
> while($num=socket_select($copy, $write=NULL, $except=NULL, NULL))
{
> for($i=0; $i<$num; $i++) {
> usleep(500);
> $msg = socket_read($copy[$i],1024);
> echo "[$i] ".strlen($msg)."\n";
> }
> $copy = $read;
> }
>
> So you save the original array of sockets to pass back in. This is
why
> the C API has FD_ISSET() to check the result of a select(). I really
> don't like this current behaviour of socket_select(). It will confuse
the
> hell out of anybody coming at this from a C background.
Yeah, it's a little confusing for C-Programmers, but I think it is OK to
do it in this way. The manual extra points a big note, that naming is
like in C, but the behaviour can be completely different.
Reverting the removing of the fd_* functions would actually more confuse
the users (again) then leaving a note in the manual ...
Just my 0,02$
Greetings,
Marcel Beerta