Jump to content

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


Guest ryen

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.