2014-03-03 10:22:40 +00:00
|
|
|
# nc
|
|
|
|
|
|
|
|
> reads and writes tcp or udp data
|
|
|
|
|
|
|
|
- listen on a specified port
|
|
|
|
|
|
|
|
`nc -l {{port}}`
|
|
|
|
|
|
|
|
- connect to a certain port (you can then write to this port)
|
|
|
|
|
|
|
|
`nc {{ip_address}} {{port}}`
|
|
|
|
|
2015-10-22 08:31:52 +01:00
|
|
|
- set a timeout
|
2014-03-03 10:22:40 +00:00
|
|
|
|
|
|
|
`nc -w {{timeout_in_seconds}} {{ipaddress}} {{port}}`
|
|
|
|
|
|
|
|
- serve a file
|
|
|
|
|
|
|
|
`cat somefile.txt | nc -l {{port}}`
|
|
|
|
|
|
|
|
- receive a file
|
|
|
|
|
|
|
|
`nc {{ip_address}} {{port}} > somefile.txt`
|
2014-03-08 02:37:44 +00:00
|
|
|
|
|
|
|
- server stay up after client detach
|
|
|
|
|
|
|
|
`nc -k -l {{port}}`
|
|
|
|
|
2014-03-08 02:46:34 +00:00
|
|
|
- client stay up after EOF
|
2014-03-08 02:37:44 +00:00
|
|
|
|
|
|
|
`nc -q {{timeout}} {{ip_address}}`
|