I'd like to check if a service is running behind a UDP port on an external machine.
The idea is that a user would be able visit a webpage and get an indication that they have correctly opened port 9999 in their router.
The service they are running is using UDP port 9999.
At the moment I have this.
<?php
$ip = '123.456.789.000';
$address = "udp://".$ip;
if(fsockopen($address, 9999))
{
print "Port 9999 is Open!";
}
else
{
print "Port 9999 is Closed!";
}
?>
The above is simple and works great for a TCP port. But the issue I'm having is that it always shows the port as open when using UDP.
Any pointers would be appreciated.
I have looked at How to check UDP port listen or not in php? but that only works internally (ie I can't bind the port) AFAIK?
I need to check the port is open on an external machine.
I have also looked at lots of others trying to piece something together but haven't managed it yet.