To reproduce, use two terminals. In the first, execute: $ nc -l 2222 In the second terminal, execute: $ echo "hi" | nc localhost 2222 This command will hang. My expectation is that nc will terminate once the end of the input stream is reached. Contrast with the behaviour of socat, which seems correct. Try this command: $ echo "hi" | socat - TCP:localhost:2222 Both listener and sender processes exit.
This is WAI. Specify -N if you need this behavior.
Wow, how did I miss this option? Thanks, and sorry.
If -N is now required to have input streams closed on EOF, nc(1) manpage needs to be updated to reflect this fact, specifically an example in CLIENT/SERVER MODEL section.