use socat instead of netcat. Something like that:
socat UDP-LISTEN:5555 EXEC:"chat -sv ping pong",pty
To check this, you can open another terminal and use socat to connect stdio and UDP socket:
socat - UDP:localhost:5555
Enter ping and you will get pong!
source share