php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24862 feof() never reports false
Submitted: 2003-07-29 18:13 UTC Modified: 2003-07-30 02:07 UTC
From: dasak36 at comcast dot net Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.3.2 OS: Windows XP pro
Private report: No CVE-ID: None
 [2003-07-29 18:13 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-29 19:22 UTC] 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 23:20 UTC] 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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC