On ubuntu, I can open a UDP port:
nc -lu 5555
Then in another terminal window, send a message:
echo "hello" | nc -u localhost 5555
The message is received at the listener side, as expected.
However this doesn't appear to work on MacOS (10.14.5). The listener invocation starts and blocks as expected, and the port appears to be open, according to lsof:
nc 22583 thisuser 3u IPv4 0x7af131578e7df639 0t0 UDP *:5555
The sending side completes with no error, but the message doesn't appear to be received at the listener side.
If instead I use a TCP listener and connection, everything works as expected. However, when the TCP listener is first opened, there is a popup to the effect of "Allow application nc to open port?" (I forget the exact message - it is not given again).
So I suspect somehow the OS has a security hook into new listeners; asks for permission with TCP, but for some reason neglects to ask permission with UDP and implicitly denies.
How can I get this to work?