php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53589 Certain Ports do not work properly on fsockopen
Submitted: 2010-12-21 15:10 UTC Modified: 2010-12-21 18:33 UTC
From: acesjunk at yahoo dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.4 OS: Windows XP SP3
Private report: No CVE-ID: None
 [2010-12-21 15:10 UTC] acesjunk at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/function.fsockopen#See Also
---

When fsocketopen is used to check if a socket is open, it returns true always on udp, which what I am trying to do is see if a server is up, this Example will always be true, no matter what, becuase I think it detects the port if it is open, rather check if it is in use. See Test Script...

Test script:
---------------
<?php
$ips = long2ip("www.aceintergraphs.com");
$sv1 = @fsockOpen("udp://$ips", (21910), $errno, $errstr, 0.25);
if (!$sv1){
	echo '<br>Server 1';
	echo '<img src="images/soffline.gif" width="100" height="8" alt="Server 1 is Offline">';
}else{
    echo '<br>Server 1';
	echo '<img src="images/sonline.gif" width="100" height="8" alt="Server 1 is Online">';
	fclose($sv1);
}
?>

Expected result:
----------------
I expect for the truth of the port being open or closed. So if server is down, then it should say server 1 Offline.  But if the Server is up, then it should say the server is online.  This all is being reported onto a webpage.  www.aceintergraphs.com! I used this before without the UDP part for a different server, and different port, which worked perfectly, but with this port 27910 for a game called Quake2, it does not work! I was trying to find alternate methods and means to do this, but with failure.  I searched your site up and down, and was unable to find a solution without having to do massive php coding.  I would like to keep things simple, not complicated!  This is going directly to my webpage, so it can not be too complex, or it will reduce load times for my site.

Actual result:
--------------
Server always shows as online, or offline when it is really online or offline!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-21 18:33 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-12-21 18:33 UTC] cataphract@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Please see the manual page for long2ip
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC