Bug #14740 Updated: fsockopen() won't timeout
| From: | jason@php.net | Date: | Wed, 29 May 2002 04:33:55 +0000 |
| Subject: | Bug #14740 Updated: fsockopen() won't timeout | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8819@lists.php.net to get a copy of this message | ||
ID: 14740
Updated by: jason@php.net
Reported By: l0cky@sn0wmen.fsnet.co.uk
-Status: Analyzed
+Status: Assigned
Bug Type: Sockets related
Operating System: Win98 and Win2k
PHP Version: 4.1.0
-Assigned To:
+Assigned To: jason@php.net
New Comment:
Will work on fix, should be available shortly
-Jason
Previous Comments:
------------------------------------------------------------------------
[2002-03-22 13:54:22] jroberts@forumone.com
Note on the previous report -- setting an integer for timeout (e.g. 1)
does not change the behaviour. It still takes 3-4 seconds without
timing out.
------------------------------------------------------------------------
[2002-03-22 13:49:59] jroberts@forumone.com
System: RedHat Linux
PHP 4.0.6
I'm specifying a timeout of 0.2 seconds, but the fsockopen() function
is taking as long as 3-4 seconds with slow domains (I know
www.krasnapolsky.sr to be slow). This example took about 3.6 seconds.
CODE:
echo microtime();
echo fsockopen("www.krasnapolsky.sr", 80, &$errno,
&$errstr, 0.2);
echo microtime();
echo "Error Number = $errno, Error String = $errstr";
RESULT:
0.39859300 1016822517
Resource id #1
0.04482100 1016822521
Error Number = 0, Error String =
So the socket is opened -- it just took way longer than I intended to
allow it.
------------------------------------------------------------------------
[2002-02-12 17:13:35] jason@php.net
The Win32 code does not set a timeout. The comment at the end refers to
there being a problm on linux, which I could not reproduce.
Winsock does support non-blocking IO, but is set up quite differently
than BSD sockets.
-Jason
------------------------------------------------------------------------
[2002-02-11 15:40:27] salvag3@netscape.net
The timeout doesn't work if the host don't respond on the
requested port :-(
os: linux redhat 7.2
php 4.0.6-7
apache 1.3.20-16
------------------------------------------------------------------------
[2002-01-28 12:19:57] korpse@p16.pub.ro
well, me too!
os: win xp professional
apache 1.3.22
php 4.1.1 (win32)
the code:
$fp = fsockopen($hname,139, &$errno, &$errstr,3);
if(!$fp) echo "$hname is not responding on port 139 ";
else {
echo "$hname is alive";
fclose($fp);
}
the problem:
the 3 secs timeout does not work
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/14740
--
Edit this bug report at http://bugs.php.net/?id=14740&edit=1