21.12 Summary
A multicast application starts by joining the multicast group assigned to the application. This tells the IP layer to join the group, which in turns tells the datalink layer to receive multicast frames that are sent to the corresponding hardware layer multicast address. Multicasting takes advantage of the hardware filtering present on most interface cards, and the better the filtering, the fewer the number of undesired packets received. Using this hardware filtering reduces the load on all the other hosts that are not participating in the application.
Multicasting on a WAN requires multicast-capable routers and a multicast routing protocol. Until all the routers on the Internet are multicast-capable, multicast is only available to a subset of Internet users. We use the term "IP multicast infrastructure" to describe the set of all multicast-capable systems on the Internet.
Nine socket options provide the API for multicasting:
Join an any-source multicast group on an interface Leave a multicast group Block a source from a joined group Unblock a blocked source Join a source-specific multicast group on an interface Leave a source-specific multicast group Set the default interface for outgoing multicasts Set the TTL or hop limit for outgoing multicasts Enable or disable loopback of multicasts
The first six are for receiving, and the last three are for sending. There is enough difference between the IPv4 socket options and the IPv6 socket options that protocol-independent multicasting code becomes littered with #ifdefs very quickly. We developed 12 functions of our own, all beginning with mcast_, that can help in writing multicast applications that work with either IPv4 or IPv6.
|