Re: nonblocking STDIN in CLI PHP app
- From: yawnmoth <terra1024@xxxxxxxxx>
- Date: 30 May 2007 19:07:47 -0700
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?
.
- Follow-Ups:
- Re: nonblocking STDIN in CLI PHP app
- From: yawnmoth
- Re: nonblocking STDIN in CLI PHP app
- References:
- nonblocking STDIN in CLI PHP app
- From: yawnmoth
- nonblocking STDIN in CLI PHP app
- Prev by Date: Re: PHP accept cookies?
- Next by Date: Re: nonblocking STDIN in CLI PHP app
- Previous by thread: nonblocking STDIN in CLI PHP app
- Next by thread: Re: nonblocking STDIN in CLI PHP app
- Index(es):
Relevant Pages
|