Answers:
简单使用telnet
:
telnet hostname port
如果获得连接,则该端口上会有某些响应。
如果收到错误消息,则说明该端口上没有程序在监听,或者主机名无效:
Connecting To hostname...Could not open connection to the
host, on port <port>: Connect failed
您可以使用iperf检查UDP端口是否可访问。
示例:测试端口5093 UDP是否在远程服务器10.0.0.1上打开
C:\>iperf -u -p 5093 -c 10.0.0.1
------------------------------------------------------------
Client connecting to 10.0.0.1, UDP port 5093
Sending 1470 byte datagrams
UDP buffer size: 8.00 KByte (default)
------------------------------------------------------------
[320] local 10.16.61.182 port 54574 connected with 10.0.0.1 port 5093
[ ID] Interval Transfer Bandwidth
[320] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec
[320] **Sent 893 datagrams**
如您所见,客户端成功传输了893个数据报,这意味着该端口确实处于打开状态。如果防火墙阻止了该端口,则应阅读以下消息:
Read failed: Connection reset by peer