Per Jessen wrote:
Jason Freeman wrote:
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.
When a file descriptor (stdin) is non-blocking, any read() will not
block and wait for data to become available, but will return right away
with or without data. Set the fd to blocking to wait for data.
/Per Jessen
This is true which is why I put fread() into a loop. If you look at the
output you will see that data is available even before the first
iteration. PHP only seems to recognize this though when the enter key is
pressed. If I press the enter key while blocking is off then it finds
the data. Is there any way to get the PHP to recognize that data is
available without pressing the enter key?