On the remote machine, listen on a specific port:
nc -vul 1234
On the host machine, connect to the same port:
nc -u the.remote.ip.addr 1234
Then still on the host you can type anything, i.e. hello and press enter. On the on the remote machine you will see:
Connection received on the.host.ip.addr 0000
hello
Oddly enough it seems that if you add the -v flag to the client command it will timeout if the port is open but the remote listener is not running. This differs from the behavior of the port being closed on the remote machine as in this case you'll get a false positive:
$ nc -vu the.remote.ip.addr 1234
$ nc -vu the.remote.ip.addr 4321
Connection to the.remote.ip.addr 4321 port [udp/*] succeeded!
source: https://serverfault.com/a/733921
man nc:
-v Produce more verbose output.
-u Use UDP instead of TCP. Cannot be used together with -x. For
Unix-domain sockets, use a datagram socket instead of a stream
socket. If a Unix-domain socket is used, a temporary receiving
socket is created in /tmp unless the -s flag is given.
-l Listen for an incoming connection rather than initiating a con‐
nection to a remote host. The destination and port to listen on
can be specified either as non-optional arguments, or with op‐
tions -s and -p respectively. Cannot be used together with -x
or -z. Additionally, any timeouts specified with the -w option
are ignored.