Last active
December 20, 2015 08:59
-
-
Save mneedham/6104020 to your computer and use it in GitHub Desktop.
netcat UDP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Start up netcat server | |
| nc -kluv localhost 9000 | |
| # Check it with lsof | |
| $ lsof -Pni :9000 | |
| COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
| nc 59231 markneedham 5u IPv6 0xd2ab0eedfdf2c00b 0t0 UDP [::1]:9000 | |
| # Send a UDP packet and see it's received | |
| $ echo -n "mark" | nc -vvu localhost 9000 | |
| Connection to localhost 9000 port [udp/cslistener] succeeded! | |
| # Try to send another packet which doesn't get received | |
| # Check lsof and see there is now a socket between 9000 and an ephemeral port (presumably from the first packet sent) | |
| $ lsof -Pni :9000 | |
| COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
| nc 59231 markneedham 5u IPv6 0xd2ab0eedfdf2c00b 0t0 UDP [::1]:9000->[::1]:60845 |
nfisher
commented
Jul 29, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment