Netcat will listen on a port and write what it receives to stdout.
nc -u -l -p 8125 # -u UDP # -l Listen # -p Port
It only works for a single line/connection. (Other versions have an option to keep listening. However, I wasn’t able to find one that ran on MacOS).