There is quite a few examples to RECEIVE multicast messages with a spcific network interface (NIC, e.g. eth0, 127.0.0.1 etc). However, there is few discussion/examples about how to SEND multicast (UDP) messages to a specific interface, e.g. local loop (127.0.0.1) instead of eth0 by default.
Background: RedHat Linux, Python, 224.1.1.1 5005
Python Code example in Multicast in Python
A similar discuss for IPv6 How to send multicast packets via a specfic interface in Linux
A similar discuss for Windows How to Multicast (send) to first NIC?
Thanks in advance.
The question that you've linked How to Multicast (send) to first NIC? mentions that you could use IP_MULTICAST_IF
:
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(addr))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With