Preventing echo | netcat from closing on EOF
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):
(echo "foo" && sleep 0.1) | ncat -u <ip> <port>
November 6, 2015