Hey, I'm still trying to write a function that will verify server availability.
I still get the same response from server
I'm not saying it's bad but yes it's very bad.20:18:03 connect : [6481][127.0.0.1]
Connection Closed, dwIoSize == 0 (Index:6481)
20:18:03 (6481)logout : [127.0.0.1]
I've tried:
andPHP Code:$GameServer['check'] = "1";
if($check = fsockopen('127.0.0.1', '55903', $ERROR_NO,$ERROR_STR, (float)0.5) and $GameServer['check'] == 1)
{
fclose($check);
$GS_Status = "<font color='#A0FFA0'><b>ONLINE</b></font>";
}
else
{
$GS_Status = "<font color='red'><b>OFFLINE</b></font>";
}
andPHP Code:function ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
}
function CheckPortStatus($Ip, $Port, $Timeout = 0.5)
{
set_error_handler('ErrorHandler'); // Disable failed connection warning
//error_reporting(0);
if($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))
{
fclose($Fp1);
return(TRUE);
} else
{
//echo($ERROR_NO.','.$ERROR_STR);
return(FALSE);
}
restore_error_handler();
}
if(CheckPortStatus('localhost', 55903))
{
echo('Online');
}
else
{
echo('Offline');
}
A lot of other solutions.PHP Code:$host = "127.0.0.1";
$port = 55903;
$timeout = 2;
$tbegin = microtime(true);
$fp = fsockopen($host, $port, $errno, $errstr, $timeout);
$responding = 1;
if (!$fp) { $responding = 0; }
$tend = microtime(true);
fclose($fp);
$mstime = ($tend - $tbegin) * 1000;
$mstime = round($mstime, 2);
if($responding)
{
echo "$host responded to requests on port $port in $mstime milliseconds!\n";
}
else
{
echo "$host is not responding to requests on port $port!";
}
My opinion? It's not working!
fsockopen for determining the availability of the website perfect.
To determine the online game server is totally incompetent!
Anyone have a workable solution controls access to the port?
- - - Updated - - -
If I use the following codes so it's actually a little DDoS attack on the Game Server![]()



? 
