When testing certain multicast connectivities in the past I have been using socat to do this:
socat -u UDP4-RECVFROM:12345,add-membership=18.104.22.168:eth0,fork,reuseaddr,readbytes=32 SYSTEM:"hexdump -C"
and then ctrl-c when I see some packets or after a second or two I see nothing.
Now this obviously gets impractical when having to do this for hundreds of multicast addresses, especially when when some of them send tens of thousands of packets per second (load is at 5000 quicker than I could hit ctrl-c).
How can I limit socat to only receive one packet and then exit? Also, how can I set a timeout for when nothing has been received (I tried -T parameter, but it doesn't seem to have any effect)