check udp socket
Posted: Fri Apr 21, 2006 9:12 am
I want to check if SNMP on (port 161) is running on a remote host.
SNMP uses UDP and I know that you should send data to UDP in order to know if the the service is
running
Consider the code :
How do I check if SNMP is running?
SNMP uses UDP and I know that you should send data to UDP in order to know if the the service is
running
Consider the code :
Code: Select all
/*Check UPD protocol : services NTP , NFS, SNMP*/
function checkPortUDP($host,$port,$timeout = 2){
$fp = @fsockopen("udp://".$host, $port, $errno, $errstr, $timeout);
if (!$fp) return false;
else return false;
}//end function