duanjia7912 2018-11-17 00:36
浏览 108

检查服务是否在外部UDP端口后运行

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.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 求学软件的前人们指明方向🥺
    • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
    • ¥15 MCNP里如何定义多个源?
    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services