ID: 50953
Updated by: [email protected]
Reported By: tony at marston-home dot demon dot co dot uk
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: Windows XP
PHP Version: 5.2.12
New Comment:
Did you install IPv6 support for XP?
Previous Comments:
------------------------------------------------------------------------
[2010-02-07 13:31:42] tony at marston-home dot demon dot co dot uk
Description:
------------
If I use fsockopen with host 'localhost' it fails, but it works with
'127.0.0.1' or any other host name.
Reproduce code:
---------------
function connect($host) {
$faultcode = null;
$faultstring = null;
$conn = fsockopen($host, 80, $faultcode, $faultstring, 20);
if (!$conn) {
echo 'faultcode=' .$faultcode .', faultstring=' .$faultstring
."\n";
} else {
echo "Connected to $host OK\n";
} // if
return $conn;
} // function
$result = connect('localhost');
$result = connect('127.0.0.1');
$result = connect('desktop');
$result = connect('www.tonymarston.net');
Expected result:
----------------
I expect to see the message "Connected to <host> OK" for all values of
host.
Actual result:
--------------
Warning: fsockopen(): unable to connect to localhost:80
faultcode=10060, faultstring=A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.
Connected to 127.0.0.1 OK
Connected to desktop OK
Connected to www.tonymarston.net OK
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50953&edit=1