Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 Hello, Is it possible for a php script to check a remote IPS UDP port and report back if theirs activity? For example if there is activity have it return "Server is UP" and if no activity "Server is Down" Im trying to see if my game server is running and its the only program to use a certain udp port.READ My reply for more info (2 down).Thanks Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/ Share on other sites More sharing options...
redarrow Posted August 2, 2006 Share Posted August 2, 2006 [code]<?php$game_sever_ip="xxxxxxxxxx";if($game_sever){echo " GAME SERVER UP";}else{echo "GAME SERVER DOWN":?>[/code] Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67594 Share on other sites More sharing options...
Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 Hey, That will tell if the Server machine isdown but what if the game server exe program crashes? It wont tell me that. I had this script :<?PHP function serverstatus($host, $port) { $sock = @fsockopen($host, $port, &$num, &$error, 2); if ($sock) { if (getservbyport($port,"udp")!=null) { $serv = getservbyport($port,"udp"); } else { $serv = "Unknown"; } echo "<center>Server : <span style='color:green'>Online</span></center>"; fclose($sock); unset($sock); }else{ echo "<center>Server : <span style='color:red'>Offline</span></center>"; unset($sock); } } //Ports To Scan , insert your info here! serverstatus("udp//127.0.0.1", 44453); // ?> But UDP wont report OFFLINE. I read that Unlike TCP, UDP is a connectionless protocol. Due to the nature of UDP, if you send a packet and don't get a response it automatically assumes the port is open. That's why you always get the online status. Anyway around that? Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67610 Share on other sites More sharing options...
Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 anyone? Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67621 Share on other sites More sharing options...
dagnasty Posted August 2, 2006 Share Posted August 2, 2006 http://us3.php.net/function.fsockopen not sure if the answer is here, but do a search for udp in that page and you might find your answer. Tired as hell wish I could offer more help Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67623 Share on other sites More sharing options...
Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 dident see anything :( Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67633 Share on other sites More sharing options...
redarrow Posted August 2, 2006 Share Posted August 2, 2006 this is what you need tell me cheershttp://www.sitepoint.com/article/udp-portscanning-php Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67638 Share on other sites More sharing options...
Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 How do i apply what they say to the above script? Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67640 Share on other sites More sharing options...
Guest ryen Posted August 2, 2006 Share Posted August 2, 2006 I guess im still a php noob, im not sure how to make the above article apply. :'( Link to comment https://forums.phpfreaks.com/topic/16294-help-script-to-scan-remote-ip-udp/#findComment-67647 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.