Server (192.168.1.9)
$ nc -lv 8000
Client
$ nc 192.168.1.9 8000
Server (192.168.1.9)
$ nc -lv 8000
Client
$ nc 192.168.1.9 8000
Option | Description | Example |
---|---|---|
-h |
nc -h | Help |
-z |
nc -z 192.168.1.9 1-100 | Port scan for a host or IP address |
-v |
nc -zv 192.168.1.9 1-100 | Provide verbose output |
-n |
nc -zn 192.168.1.9 1-100 | Fast scan by disabling DNS resolution |
-l |
nc -lp 8000 | TCP Listen mode (for inbound connects) |
-w |
nc -w 180 192.168.1.9 8000 | Define timeout value |
-k |
nc -kl 8000 | Continue listening after disconnection |
-u |
nc -u 192.168.1.9 8000 | Use UDP instead of TCP |
-q |
nc -q 1 192.168.1.9 8000 | Client stay up after EOF |
-4 |
nc -4 -l 8000 | IPv4 only |
-6 |
nc -6 -l 8000 | IPv6 only |
Connect to a host located anywhere
$ nc [options] [host] [port]
Listen for incoming connections
$ nc -lp port [host] [port]