Jump to content


Help! Script to Scan Remote IP UDP....


  • Please log in to reply
8 replies to this topic

#1 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 05:45 AM

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

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 August 2006 - 05:57 AM


<?php

$game_sever_ip="xxxxxxxxxx";

if($game_sever){

echo " GAME SERVER UP";

}else{

echo "GAME SERVER DOWN":

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 06:39 AM

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?

#4 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 06:47 AM

anyone?

#5 dagnasty

dagnasty
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 02 August 2006 - 06:49 AM

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

#6 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 06:57 AM

dident see anything :(

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 August 2006 - 07:12 AM


this is what you need tell me cheers

http://www.sitepoint...ortscanning-php
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 07:15 AM

How do i apply what they say to the above script?

#9 Guest_ryen_*

Guest_ryen_*
  • Guests

Posted 02 August 2006 - 07:24 AM

I guess im still a php noob, im not sure how to make the above article apply.

:'(




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users