如下示例代码实现了用telnet命令测试端口连通性的功能:
端口通信正常
-bash-4.1$ echo " " | telnet 192.0.0.1 10100
Trying 10.71.133.9...
Connected to 10.71.133.9.
Escape character is '^]'.
Connection closed by foreign host.
#端口通信异常
-bash-4.1$ echo " " | telnet 192.0.0.1 10100
Trying 192.0.0.1...
telnet: connect to address 192.0.0.1: Connection timed out
如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。
如本文对您有用,捐赠和留言 将是对我最好的支持~(捐赠可转为站内积分)
如愿意,请向朋友推荐本站,谢谢。
尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。