IP multicast falls into the category of nonrooted data plane and nonrooted control plane. All applications play a leaf role. Currently, most IP multicast implementations use a set of socket options proposed by Steve Deering to the Internet Engineering Task Force (IETF). Five operations are thus made available:
- IP_MULTICAST_TTL—Sets time-to-live, controls scope of a multicast session.
- IP_MULTICAST_IF—Determines interface to be used for multicasting.
- IP_ADD_MEMBERSHI —Joins a specified multicast session.
- IP_DROP_MEMBERSHIP—Drops out of a multicast session.
- IP_MULTICAST_LOOP—Controls loopback of multicast traffic.
Setting the time-to-live for an IP-multicast socket maps directly to using the SIO_MULTICAST_SCOPE command code for WSAIoctl.
The method for determining the IP interface to be used for multicasting is through a TCP/IP-specific socket option as described in the Windows Sockets 2 Protocol-Specific Annex. The remaining three operations are covered well with the Windows Sockets 2 semantics described here.
The application would open sockets with c_leaf/d_leaf flags in WSASocket. It would use WSAJoinLeaf to add itself to a multicast group on the default interface designated for multicast operations. If the flag in WSAJoinLeaf indicates that this socket is only a sender, then the join operation is essentially a no-op and no IGMP messages need to be sent. Otherwise, an IGMP packet is sent out to the router to indicate interests in receiving packets sent to the specified multicast address. Since the application created special c_leaf/d_leaf sockets used only for performing multicast, the standard closesocket function would be used to drop out of the multicast session. The SIO_MULTIPOINT_LOOPBACK command code for WSAIoctl provides a generic control mechanism for determining whether data sent on a d_leaf socket in a nonrooted multipoint scheme can also be received on the same socket.
The Winsock version of the IP_MULTICAST_LOOP option is semantically different than the UNIX version of the IP_MULTICAST_LOOP option:
- In Winsock, the IP_MULTICAST_LOOP option applies only to the receive path.
- In the UNIX version, the IP_MULTICAST_LOOP option applies to the send path.
For example, applications ON and OFF (which are easier to track than X and Y) join the same group on the same interface; application ON sets the IP_MULTICAST_LOOP option on, application OFF sets the IP_MULTICAST_LOOP option off. If ON and OFF are Winsock applications, OFF can send to ON, but ON cannot sent to OFF. In contrast, if ON and OFF are UNIX applications, ON can send to OFF, but OFF cannot send to ON.