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 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python