Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 581 Bytes

nc.md

File metadata and controls

37 lines (26 loc) · 581 Bytes

nc

nc, ncat, netcat

client

# tcp example.com:8080
nc example.com 8080

# udp example.com:8080
nc -u example.com 8080

server

# bind and listen
nc -l 0.0.0.0 8080

# keep open for multiple connections
nc -lk 0.0.0.0 8080

# bind to unix socket
nc -lU /var/run/example-socket

options

  • -4: Use IPv4 only
  • -6: Use IPv6 only
  • -l: bind and listen for incoming connections
  • -k: with listen, keep open
  • -p <port>: set the source port
  • -s <ip>: set the source ip
  • --broker: with listen, send all input to all connected clients