简体   繁体   中英

Receiving Multicast: Does TTL matter?

When joining a multicast group, what effect does the IP_MULTICAST_TTL have when receiving datagrams?

Multicast in Python has one of the answers with a TTL as 32 on the receiving side (and IP_MULTICAST_LOOP as 1), but I'm having a hard time figuring out why.

I was reading Multicast Programming and I don't understand why TTL and LOOP are necessary for the receiver .

When you receive a multicast, I thought you just tell the kernel to join a multicast group and it will then bind the port the data is being sent to.

As a receiver, do you also send data out when receiving a multicast? Is this why IP_MULTICAST_TTL and IP_MULTICAST_LOOP are set when receiving? Can you influence a network by just joining a multicast group?

Thanks

It won't prevent you from receiving multicast messages per se, but it may influence the reach of the IGMP message that gets sent out when you join the mcast group (which is sent as a result of calling setsockopt with the IP_ADD_MEMBERSHIP flag).

So if there's an upstream router that is participating in the multicast network, it may not receive your join request if the TTL is too low. Subsequent incoming multicast messages to your joined address may not get routed to you if the intermediate router doesn't know you've joined the group.

The LOOP option isn't relevant if you don't send anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM