I recommend that you do not use INADDR_ANY. In production multicast environments, you want to be very specific on your multicast sockets and don't want to do things like sending igmp integrates all the interfaces. This leads to workarounds for hackers when everything does not work like "route add -host 239.1.1.1 dev eth3" to receive multicast connections in the correct order depending on the system in question. Use this instead:
def joinMcast(mcast_addr,port,if_ip): """ Returns a live multicast socket mcast_addr is a dotted string format of the multicast group port is an integer of the UDP port you want to receive if_ip is a dotted string format of the interface you will use """
In mcastsock.bind you can also use '' instead of the address bar, but I advise against this. With ``, if you have a different socket using the same port, both sockets will receive data from each other.
Ian
source share