Re: Problem with getting non-blocking data from stdin

From: Date: Sat, 20 Sep 2003 05:52:49 +0000
Subject: Re: Problem with getting non-blocking data from stdin
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163274@lists.php.net to get a copy of this message
* Thus wrote Robert Cummings (robert@interjinn.com): > I wanted t play around with the CGI (not CLI) version of PHP and get a > feel for the I/O stuff, specifically STDIN. So I whipped up the > following script: > > /////////////////////////////////////////////////////////////////// > > #!/usr/bin/php -qC > <? > > if( ($stdin = fopen( 'php://stdin', 'r' )) === false ) > { > echo 'Failed to open STDIN'."\n"; > exit(); > } > > stream_set_blocking( $stdin, false ); I believe this is not needed, stdin is nonblocking all the time. > > $count = 0; > while( 1 ) this will never exit until php runs out of memory, and most likely will lead to unexpected results. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#163274) next »