Hello, everyone!
Today, I'd like to share with you the knowledge about joining multicast groups and reporting and querying protocols in the IGMP protocol.
Joining a Multicast Group
Fundamental to multicasting is the concept of a process joining a multicast group on a given interface on a host. (We use the term process to mean a program being executed by the operating system.) Membership in a multicast group on a given interface is dynamic— it changes over time as processes join and leave the group.
We imply here that a process must have a way of joining a multicast group on a given interface. A process can also leave a multicast group that it previously joined. These are required parts of any API on a host that supports multicasting. We use the qualifier "interface" because membership in a group is associated with an interface. A process can join the same group on multiple interfaces.
The release of IP multicasting for Berkeley Unix from Stanford University details these changes for the sockets API.
Implied here is that a host identifies a group by the group address and the interface. A host must keep a table of all the groups that at least one process belongs to and a reference count of the number of processes belonging to the group.
IGMP Reports and Queries
IGMP messages are used by multicast routers to keep track of group membership on each of the router's physically attached networks. The following rules apply.
1. A host sends an IGMP report when the first process joins a group. If multiple processes on a given host join the same group, only one report is sent, the first time a process joins that group. This report is sent out to the same interface on which the process joined the group.
2. A host does not send a report when processes leave a group, even when the last process leaves a group. The host knows that there are no members in a given group, so when it receives the next query (next step), it won't report the group.
3. A multicast router sends an IGMP query at regular intervals to see if any hosts still have processes belonging to any groups. The router must send one query out of each interface. The group address in the query is 0 since the router expects one response from a host for every group that contains one or more members on that host.
4. A host responds to an IGMP query by sending one IGMP report for each group that still contains at least one process.
Using these queries and reports, a multicast router keeps a table of which of its interfaces have one or more hosts in a multicast group. When the router receives a multicast datagram to forward, it forwards the datagram (using the corresponding multicast link-layer address) only out the interfaces that still have hosts with processes belonging to that group.
As shown in the following figure, the two IGMP packets are Report messages sent by hosts and Query messages sent by routers. Routers require each host to identify each group on an interface.

Welcome to leave your comments below the post,
I hope it will be helpful to you. Thank you!

