macos環境測試遠程端口是否通

ping端口:nc -vz -w 2 www.baidu.com 8080ide

NAME
nc -- arbitrary TCP and UDP connections and listens
this

DESCRIPTION
The nc (or netcat) utility is used for just about anything under the sun involving TCP or UDP. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6. Unlike telnet(1), nc scripts nicely, and separates error messages onto standard error instead of sending them to standard output, as telnet(1) does with some.
code

-v      details
 -z      Specifies that nc should just scan for listening daemons, without sending any data to them.  It is an error to use this option in conjunction with the -l option.
     -w     timeout

     主機和端口號不能缺失
相關文章
相關標籤/搜索