#24862 [Opn->Csd]: feof() never reports false
ID: 24862
Updated by: sniper@php.net
Reported By: dasak36 at comcast dot net
-Status: Open
+Status: Closed
Bug Type: Sockets related
Operating System: Windows XP pro
PHP Version: 4.3.2
Previous Comments:
------------------------------------------------------------------------
[2003-07-29 23:20:39] dasak36 at comcast dot net
Thank you. It seems to work now, but it takes it a long time to find
the end it seems. Maybe i just need to set a timeout or somethin.
Thanks again,
tommy
------------------------------------------------------------------------
[2003-07-29 19:22:27] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
The stream_set_blocking($fp, false); is not necessary.
------------------------------------------------------------------------
[2003-07-29 18:13:27] dasak36 at comcast dot net
Description:
------------
I read a thread on this here at bugs.php.net. It is the only one I can
find of its kind. The problem I am having is this. Whenever I am
reading the information from a socket like in the below code(which i
got from the other post here):
$fp = fsockopen("localhost", 25);
stream_set_blocking($fp, false);
fwrite($fp, "QUIT\r\n");
while(!feof($fp)) {
$data = fgets($fp);
var_dump($data);
}
echo "\nAll done\n";
The page hangs because feof($fp) never returns true.
I've been messing with this for a while but I cannot get this to work.
PHP version 4.3.2.
Thanks,
Tommy
PS: after I submitted this the site gave me other posts to check.
Some have the similar problem, but as before none were really answered.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24862&edit=1
Thread (4 messages)