Server Status in PHP

Results 1 to 8 of 8
  1. #1
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    angry Server Status in PHP

    Hey, I'm still trying to write a function that will verify server availability.

    I still get the same response from server

    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'm not saying it's bad but yes it's very bad.

    I've tried:

    PHP 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>";

    and

    PHP 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');
        } 
    and

    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($mstime2);
     
    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!";

    A lot of other solutions.

    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


  2. #2

    Re: Server Status in PHP

    there is no point having server status if its online or offline .. u just keep it online, why u want it that badly to know if ur online? or offline

  3. #3
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: Server Status in PHP

    I know that's impossible, therefore, that way it definitely will not.

    Players not verify that the port through but trying to cram into it, not to them that send packets to the server and occupy the port.

    Only I wonder if anyone has a functional verification using fsockopen.

    I have a Web server status that can be easily turned on and off.

    This is perhaps the best solution.

    PHP Code:
    $revenge['online']    =    "1";        // Status serveru ( 1 => ONLINE, 0 => OFFLINE )

    if($revenge['online']    ==    1)     {    $GS_Status    =    "<font color='#A0FFA0'><b>ONLINE</b></font>";    }
    else        {    
    $GS_Status    =    "<font color='red'><b>OFFLINE</b></font>";        } 

  4. #4

    Re: Server Status in PHP

    my question was why is this neccessaryServer Status in PHP?


    Sent from my iPhone.

  5. #5
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: Server Status in PHP

    Since players do not read the news and information about outages.

  6. #6
    DarkMu wolfulus is offline
    MemberRank
    Jul 2006 Join Date
    BrazilLocation
    307Posts

    Re: Server Status in PHP

    Yeah, this is bad. Flooding connections to the GameServers.

    One option you have is:

    Use the same principle, but instead of connecting to GameServer port, connect to ConnectServer instead (44405)
    (You just need to shutdown ConnectServer too when servers is down to display offline status)

    Another option (the one I used to use on my servers):

    Connect to ConnectServer and send protocol requests for server list. ConnectServer should send a response with complete server list and server load too. With that information you can check all the online servers.

    You should cache the result btw, to avoid this whole process. Remember you're using PHP, and PHP blocks.

  7. #7
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: Server Status in PHP

    I think a better way would be connecting via Game Connect server to server using credentials from the gaming account.

    After several conditions would be enough to make this bill never appeared on the website.

    And suddenly a miracle, check server finished.

  8. #8
    DarkMu wolfulus is offline
    MemberRank
    Jul 2006 Join Date
    BrazilLocation
    307Posts

    Re: Server Status in PHP

    I don't understand what you mean. ConnectServer doesn't handle any type of user information.



Advertisement