Your command should work. It is very similar to some of the examples in the
This is exactly how
netcat is supposed to operate: once it has reached EOF on stdin, it (one-way) closes the connection /to/ the server and then waits for data coming from the server. When the latter closes the connection (the other way: server->client), then
netcat command doesn't finish, I suppose there is something strange happening at the network level that keeps the
echo server listening for additional input.
You can try out the
-q option to force
netcat to stop N seconds after EOF is encountered on stdin:
netcat -q1 server echo <<< "test"
<<< "test" is a
bashism, use your
echo ... | syntax if you don't use