On 4 December 2012 01:51, Joseph Sulewski <joemacher@gmail.com> wrote:

When I call socket->bind I provide it with an endpoint.  When I create the endpoint I'm currently using the multicast address, what should I use for the address? 

If you bind to INADDR_ANY then the OS will use its ip routing tables to work out which the best local nic to use is. You can force it to use a specific local nic by providing its address. Most applications will use INADDR_ANY

If I'm binding to multiple multicast addresses it doesn't make sense to bind to one of them.

Because UDP is connectionless there is no way for the kernel / network stack to know which pid to deliver datagrams to for a particular port unless you bind your socket's file descriptor to that port.
(note, if you want to allow other file descriptors to be able to bind to that port you need to set SO_REUSEADDR to 1)
 

Finally,  it appears I can join multiple multicast groups but they need to be the same port.  Is this correct?

The reason for this is as my previous point above. What you would do is create as many sockets as there are different ports, and have each socket join the multicast addresses which are on that port