Recieving UDP multicast data

Im having a bit of difficulty understanding UDP multicast. I want to have more than one user running an application(listener/client) on the same machine and have all receive multicast messages sent from other machines. I have tried the starting with the multicast UDPExample project that ships with Xojo It works fine between different machines, however it seems to only allow one instance to run per machine. I get AddressInUseError (105) on the second instance per machine - I am assuming because the UDP socket in each instance attempts to bind to the same ip# and port#.

Is it possible to configure the an app to have multiple clients on a single machine listen to the same multicast message stream or do I need to invent some kind of subscription service per machine that the clients connect to?

Are there any examples or plugins out there that would help me?

Any process can write to a given port, but only one process per machine can listen to that port.

I can’t speak for the Xojo framework specifically, but in general it is perfectly valid for multiple processes to subscribe (bind) to the same multicast group (port) on the same interface simultaneously.

Thanks Tim.

After some additional digging I found this is apparently a limitation in what functionality Xojo’s UDPSocket provides - not with multicast in general. If I have misunderstood something please correct me, but below is what Ive found so far.

I found this on the old forum:

Basically it appears that I need to access low level socket options SO_REUSEADDR and SO_REUSEPORT that Xojo UDPSocket does not expose to me.

I have tested the concept using some standard ‘C’ examples I found at:

With the above I am indeed able to have many simultaneous listeners to the same multicast send all on a single machine…

Now I just need to figure out how to implement same in Xojo. If someone already has a solution please let me know.

And just in case its helpful to others exploring this topic… It appears from the C-code testing ive done, I need SO_REUSEPORT on OSX and SO_REUSEADDR on Centos…

Thanks all.

Good to know. Thanks.