MLD and IGMP Using Windows Sockets

Windows Sockets enables the Multicast Listener Discovery (MLD) on IPv6 and the Internet Group Management Protocol (IGMP) on IPv4 for multicast applications through the use of socket options and IOCTLs. This page describes the socket options that enable multicast programming, and describes how they are used. For definitions of each socket option, consult the Socket Options page.

For information on using IOCTLs for multicast programming, see Final-State-Based Multicast Programming later in this section.

On Windows Vista and later, a set of socket options are available for multicast programming that support IPv6 and IPv4 addresses. These socket options are IP agnostic and can be used on both IPv6 and IPv4. On IPv6, these socket options use MLDv2. On IPv4, these socket options use IGMPv3. These IP agnostic options are the preferred socket options for multicast programming on Windows Vista and later. Windows Sockets uses the following socket options:

Socket option Argument type
MCAST_BLOCK_SOURCE GROUP_SOURCE_REQ structure
MCAST_JOIN_GROUP GROUP_REQ structure
MCAST_JOIN_SOURCE_GROUP GROUP_SOURCE_REQ structure
MCAST_LEAVE_GROUP GROUP_REQ structure
MCAST_LEAVE_SOURCE_GROUP GROUP_SOURCE_REQ structure
MCAST_UNBLOCK_SOURCE GROUP_SOURCE_REQ structure

 

A set of socket options are available for multicast programming that support IPv6 only addresses. These socket options use MLDv1 or MLDv2. The version of MLD used is dependent on the version of Windows. MLDv2 is supported on Windows Vista and later. Windows Sockets uses the following socket options:

Socket option Argument type
IPV6_ADD_MEMBERSHIP ipv6_mreq structure
IPV6_DROP_MEMBERSHIP ipv6_mreq structure

 

A set of socket options are available for multicast programming that support IPv4 only addresses. These socket options use IGMPv3 or IGMPv2. The version of IGMP used is dependent on the version of Windows. IGMPv3 is supported on Windows Vista and later. Windows Sockets uses the following socket options:

Socket option Argument type
IP_ADD_MEMBERSHIP ip_mreq structure
IP_ADD_SOURCE_MEMBERSHIP ip_mreq_source structure
IP_BLOCK_SOURCE ip_mreq_source structure
IP_DROP_MEMBERSHIP ip_mreq structure
IP_DROP_SOURCE_MEMBERSHIP ip_mreq_source structure
IP_UNBLOCK_SOURCE ip_mreq_source structure

 

When IGMPv3 is available, the IP_ADD_SOURCE_MEMBERSHIP, IP_BLOCK_SOURCE, IP_DROP_SOURCE_MEMBERSHIP, and IP_UNBLOCK_SOURCE options are handled more efficiently since the router can handle the filtering. When only IGMPv2 is available, the host must handle the filtering.

There are two categories into which most applications are likely to fall: any-source and controlled-source.

  • Any-source applications accept all sources by default, allowing individual sources to be turned off as required. An example of an any-source application is a video conference call that enables all recipients to participate.
  • Controlled-source applications limit sources to a given list, such as an Internet radio station, or the broadcast of a notable event. The process of using socket options is slightly different for each.

On Windows Vista and later, the following steps apply for any-source applications:

  • Use MCAST_JOIN_GROUP to join a group.
  • Use MCAST_BLOCK_SOURCE to turn off a given source, if required.
  • Use MCAST_UNBLOCK_SOURCE to re-allow a blocked source, if required.
  • Use MCAST_LEAVE_GROUP to leave the group.

On Windows Vista and later, the following steps apply for controlled-source applications:

  • Use MCAST_JOIN_SOURCE_GROUP to join each group/source pair.
  • Use MCAST_LEAVE_SOURCE_GROUP to leave each group/source, or use MCAST_LEAVE_GROUP to leave all sources, if the same group address is used by all sources.

The following steps apply for any-source applications:

  • Use IP_ADD_MEMBERSHIP to join a group (IPV6_ADD_MEMBERSHIP for IPv6).
  • Use IP_BLOCK_SOURCE to turn off a given source, if required.
  • Use IP_UNBLOCK_SOURCE to re-allow a blocked source, if required.
  • Use IP_DROP_MEMBERSHIP to leave the group (IPV6_DROP_MEMBERSHIP for IPv6).

The following steps apply for controlled-source applications:

  • Use IP_ADD_SOURCE_MEMBERSHIP to join each group/source pair.
  • Use IP_DROP_SOURCE_MEMBERSHIP to leave each group/source, or use IP_DROP_MEMBERSHIP to leave all sources, if the same group address is used by all sources.

The order in which these socket options are set has associated rules. For information and troubleshooting information on multicast socket options, see Multicast Socket Option Behavior.