Preventing echo | netcat from closing on EOF
The problem:
echo "foo" | ncat -u <ip> <port>
closes before printing any return value from the (UDP, in this case) server.
There are various solutions proposed. The -q or -Q options don't exist on my system. Using echo -n
doesn't help. I didn't try to do a mkfifo
. The quick and dirty way worked best (adjust delay based on latency):
1 | (echo "foo" && sleep 0.1) | ncat -u <ip> <port>
|
Ches Koblents
November 6, 2015