I want to send only one short value in a UDP packet, but running the command
echo -n \"hello\" | nc -4u localhost 8000
I can see that the serve
If you are using bash, you might as well write
echo -n "hello" >/dev/udp/localhost/8000
and avoid all the idiosyncrasies and incompatibilities of netcat.
This also works sending to other hosts, ex:
echo -n "hello" >/dev/udp/remotehost/8000
These are not "real" devices on the file system, but bash "special" aliases. There is additional information in the Bash Manual.