Results 1 to 7 of 7

Thread: [RESOLVED] Checking is IP Online?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Resolved [RESOLVED] Checking is IP Online?

    I would like to create check online status for gameserver so is there any kind of way to do that?

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Checking is IP Online?

    If you know which port the gameserver is running on, you could use fsockopen to check whether it is up or not.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Question Re: Checking is IP Online?

    I already used this, but i don't get right answer.
    (Let's play that mysql is my gameserver now.)

    PHP Code:
    <?php
    $Get 
    fsockopen("127.0.0.1""3306"$ErrorNo$ErrorSTR5);
    if(
    $Get) {
        echo 
    "Online";
    }
    else {
        echo 
    "Offline";
    }
    ?>
    MySQL as turned off.
    Warning: fsockopen() [function.fsockopen]: unable to connect to 127.0.0.1:3306 (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. ) in C:\AppServ\www\index.php on line 9
    Offline
    MySQL as turned on.
    Online
    How do i can filter this: "Warning" message from offline mode to only "Offline".

    Still using same code. Just took MySQL for example.

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Checking is IP Online?


  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Question Re: Checking is IP Online?

    Quote Originally Posted by kows View Post
    Thank you this helped.

    Didn't knew any keywords of this and it didn't came to my mind.

  6. #6
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: [RESOLVED] Checking is IP Online?

    hey Zeuz this code doesn't show the errors if the warnings are on... by the way, the warnings are good to have on.

    Code:
    <?php
    $host = "192.168.1.15"; // ip or domain
    $port = "80";
    @$socket = fsockopen($host, $port, $errno, $errstr, 5);
     if(!$socket) { 
      echo "Offline";
     } else { 
      fclose($socket); 
      echo "Online";
     } 
    ?>

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: [RESOLVED] Checking is IP Online?

    Oh. I try this later Justa.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width