Telnet 检测TCP端口
[root@localhost ~]# telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
NC 检测TCP端口
[root@localhost ~]# nc -vz 127.0.0.1 8906
Connection to 127.0.0.1 8906 port [tcp/*] succeeded!
NC 检测UDP端口
检测udp端口的时候不会立即返回测试结果,可能需要等待几秒钟
[root@apexsoft ~]# nc -uz 127.0.0.1 8907
Connection to 127.0.0.1 8907 port [udp/*] succeeded!