|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-09 07:16 UTC] wez@php.net
[2004-08-26 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Description: ------------ I'm using Fedora Core 1 and PHP 4.3.8 I'm using the fsockopen function to check status of port for a windows environment. I'm going thru the WAN to check this port which is two hops away. For some reason I had a routing issue to the destination network. I tried to ping the server from my windows workstation and I would get reply from the router (as opposed to just getting a request timeout message) saying the destination network was unavailable. Anyway, when I ran the script that checks the server (from the fedora machine), the php script would report the server as up, when in reality it couldn't be reached. I'm guessing cause the router respoded with reply messages that the fsockopen function assumes a connection is made? Reproduce code: --------------- $host = '192.168.1.1'; $port = '445'; $timeout = '2'; $fp = fsockopen($host, $port, $errno. $errstr, $timeout); if ($fp) { print 'server_up.gif'; }else{ print 'server_down.gif'; } Expected result: ---------------- Should show the host is not reachable and print "the device is down". Actual result: -------------- given the conditions mentioned above, the server should show down, but the fsockopen says its up.