|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15091 socket_set_timeout not part of windows binary
Submitted: 2002-01-17 18:28 UTC Modified: 2002-07-10 11:47 UTC
Avg. Score:4.9 ± 0.3
Reproduced:11 of 11 (100.0%)
Same Version:8 (72.7%)
Same OS:8 (72.7%)
From: Rajkumar dot Bellan at saint-gobain dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.1.1 OS: windows 2000
Private report: No CVE-ID: None
 [2002-01-17 18:28 UTC] Rajkumar dot Bellan at saint-gobain dot com
I am using windows binaries.

$fp = $fsockopen(($ip_addr, $port_no, $errno, $errstr, 30);
do {
   if (!feof($fp)) {
            $livedata = trim(fgets($fp,128));
             echo $livedata."\n";
    else {
} while(true);

when there is no data being sent by the server my script waits indefinitely at fgets. I tried using socket_set_blocking($fp, false) but that does get me data every one second. I tried to use socket_set_timeout that is when I found out it is not supported in windows binaries. Is there any other way to solve this problem in windows.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-17 18:32 UTC] Rajkumar dot Bellan at saint-gobain dot com
Correction to my earlier report. When using socket_set_blocking($fp, false) I am "not" getting data every one second
 [2002-01-18 10:04 UTC]
Why are you using $fsockopen and not fsockopen? That might be the cause of this bug.
 [2002-01-18 10:10 UTC] Rajkumar dot Bellan at saint-gobain dot com
correction that was a typo on my part. I did use fsockopen.
The program is working fine as long as there is data coming from the other side. But if there is no data the fgets call waits indefinitely without timing out. That is the reason I tried to use socket_set_timeout. Unfortunately i get the message that socket_set_timeout is not part of windows build.
 [2002-01-20 14:09 UTC] jjkil at hotmail dot com
PHP version: 4.1.1
Windows XP using IIS
Installed from the executable download.

Using the set_socket_timeout method causes the following error message to appear in the browser:

Warning: socket_set_timeout() is not supported in this PHP build in c:\inetpub\wwwroot\test.php on line 26
 [2002-07-10 11:47 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 02:03:41 2022 UTC