Why don't you prototype it with netcat:
Terminal 1:
$ nc -u -l -p 4000 localhost
hej
asdf
^C
$
Terminal 2:
$ nc -u localhost 4000
hej
asdf
^C
$
Instead of two terminals, use two computers and write a sender and
a receiver program, and start debugging.