Re: nonblocking STDIN in CLI PHP app
- From: yawnmoth <terra1024@xxxxxxxxx>
- Date: 30 May 2007 19:15:26 -0700
On May 30, 9:07 pm, yawnmoth <terra1...@xxxxxxxxx> wrote:
I think this is a better way to approach my question. Here's my
script:
<?php
$stdin = fopen('php://stdin', 'r');
stream_set_blocking($stdin, false);
$last_date = '';
while (true)
{
fread($stdin, 1024);
if ($last_date != date('g:ia'))
{
$last_date = date('g:ia');
echo "The time is now [$last_date]\r\n";
}
}
If I comment out the fread, it echo's the time once a minute. If I
leave the fread as it is, it doesn't. My question is... why?
Blocking is set to false, so why does it appear to be blocking, anyway?
Never mind... I think the following URL addresses my problem:
http://bugs.php.net/34972
.
- References:
- nonblocking STDIN in CLI PHP app
- From: yawnmoth
- Re: nonblocking STDIN in CLI PHP app
- From: yawnmoth
- nonblocking STDIN in CLI PHP app
- Prev by Date: Re: nonblocking STDIN in CLI PHP app
- Next by Date: Re: PDO support (bit of a rant)
- Previous by thread: Re: nonblocking STDIN in CLI PHP app
- Next by thread: Quote Request Form
- Index(es):
Relevant Pages
|