Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   server status on webpage (https://postpacific.loc-online.com/showthread.php?t=6359)

dirkr 02.12.2006 18:54

server status on webpage
 
i've been looking arround how to show it .. cant really find it if it stores it anywhere or something.

so any hints tips on on how to get auth and world status to display on a webpage?

i dont request ready to plugin in code i'm willing to work at it..but atm i have no clue to be honest

if code pref php :)

thnx ^^

Firedaemon 02.12.2006 19:35

Take a look at the php function fopen

Code:

http://www.php.net/fopen
It is very easy to impliment

Gaikotsu 02.12.2006 23:06

Code:

function GetServerStatus($ip, $port)
{
 error_reporting(0);
 if ($fp = fsockopen($ip, $port, $ERROR_NO, $ERROR_STR, (float) 0.5))
  {
  fclose($fp);
  return true;
  }
 else
  return false;
}

$ip - server ip
$port - server port, 7777 - gameserver, 2106 - auth

if server work - returned true, else - false

dirkr 03.12.2006 11:29

great thnx for even helping on the code ^^
thought it couldnt be that hard

btw if you try to connect on the worldserver without going thru the authserver will it reject the socketrequest or just try and open the socket and return the correct value? just wondring :p

edit : you sure the gameserver is 7777 ? cause i get false even tho its up.. if i print out the $ERROR_STR it gives me connection timed out.
i've tried putting the timeout longer..same thing.. so i'm a bit lost here..

edit2 : k when i put the script on the box where the gameserver runs it works, but remote it doenst ( only shows auth up then )
is there a way to get the gameserver status from a remote location? cause if i run it on the server itself .;and the entire box goes down the webpage will error out ( the normal webpage is on a different server )

Lockbete 03.12.2006 12:46

ur firewall is probably blocking connections to 7777 from the outside so you have to allow the IP u have the script running on to connect to port 7777.

dirkr 03.12.2006 13:12

firewall allows connections from any ip to port 7777 and still nothing..

hm k for some reason the webhost i used was not allowing me to connect to 7777 but it was allowing me to connect to 2106 ..weirdness
thnx for the help guys appreciate it


All times are GMT. The time now is 15:04.