Hi All
I am having a problem getting stream_set_blocking to work the way I
expect on STDIN. Please could someone tell me why while blocking is set
to false fread does not get anything. Sampe code follows:
Code:
<?php
stream_set_blocking(STDIN, false);
fputs(STDOUT, chr(27)."[6n");
sleep(1);
fputs(STDOUT, "\r\n");
for ($i = 0; $i < 10; $i++){
$pos = fread(STDIN, 1024);
fputs(STDOUT, "-->".$pos."\r\n");
sleep(1);
}
stream_set_blocking(STDIN, true);
$pos = fread(STDIN, 1024);
fputs(STDOUT, "-->".$pos."\r\n");
?>
Actual Output:
php5 test.php
^[[24;1R
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->[24;1R
Expected Output:
php5 test.php
^[[24;1R
-->[24;1R
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
Thanks
Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php