ozzybwild 0 Posted November 6, 2012 Hi everyone!I hope I found the right place to ask about this..The problem I have is, that I want to check whether our servers are running or not (like all those serverlisting-services do).My attempt is to check via fsockopen and thereby ping the ip and the port the server(s) run(s) on.<?php//Pingcall:function ping($host,$port,$timeout=10){$fsock = fsockopen($host, $port, $errno, $errstr, $timeout);if ( ! $fsock ){echo "! ".$errno." ".$errstr." !";return FALSE;}else{return TRUE;}}//Listeneintrag, functioncall und Darstellung:function checkserver($name,$host,$port){$up = ping($host,$port);echo $name.": ".$host.":".$port." - ";// onlineif( $up ){echo "<img src=\"on.png\" alt=\"Server online!\"><br>--------------------------------------<br>";}// offlineelse{echo "<img src=\"off.png\" alt=\"Server offline!\"><br>--------------------------------------<br>";}}//HTML-Header, meta-refreshecho "<HTML><HEAD><TITLE>Serverstatus</TITLE><META http-equiv=\"refresh\" content=\"150; URL=status.php\"></HEAD><BODY bgcolor=\"black\" TEXT=\"white\">";//Serverliste:checkserver('SERVERNAMEHERE',"IPHERE","PORTHERE");//HTML-Footerecho "<br><br>©2012: ozzybwild</P></BODY></HTML>";?>"SERVERNAMEHERE", "IPHERE" and "PORTHERE" hold a name to display, the IP to be pinged and the port to access.However it works with none of the DayZ servers I am checking. Pinging my linux root at port 80 however works like a charm, no matter whether I ping the IP itself or the TLD..Does anyone have an idea how I can check if the serverside application (/DayZ Server) is running or not? Share this post Link to post Share on other sites
ersan 219 Posted November 6, 2012 You can't really ping an application running on a port, pinging something generally means ICMPFor one thing, arma 2 runs on UDP - so you need to change your host to udp://ip.goes.here - just seeing if the port can be connected to doesn't really mean the server is online. We use the GameQ PHP library to query our game servers from PHP, I would recommend that instead of your method. 1 Share this post Link to post Share on other sites
ozzybwild 0 Posted November 7, 2012 Ace!Took some time to figure out filterung the results properly ( //Use Magic is the most WTF comment I ever read in a source.. :D ), but GameQ is excellent for the job.Thanks a lot, you got my beans! :) Share this post Link to post Share on other sites
0xdecafbad 0 Posted November 9, 2012 How do you query the game server with GameQ? ARMA and DayZ arn't on the list of supported games. Share this post Link to post Share on other sites
sanzzes 16 Posted November 25, 2012 Ich find es lustig wie du in deiner Script Beschreibung Deutsch und Englisch nutzt :D Share this post Link to post Share on other sites