DatagramSocket.JoinMulticastGroup(HostName) Method


Joins a DatagramSocket object to a multicast group.

 virtual void JoinMulticastGroup(HostName ^ host) = JoinMulticastGroup;
void JoinMulticastGroup(HostName const& host);
public void JoinMulticastGroup(HostName host);
function joinMulticastGroup(host)
Public Sub JoinMulticastGroup (host As HostName)



The hostname or IP address for the multicast group.

Windows requirements

App capabilities


To receive multicast packets on the DatagramSocket object, an app must assign the MessageReceived event to an event handler, bind to a local service name or UDP port and a local hostname or IP address using the BindEndpointAsync or BindServiceNameAsync method, and then call the JoinMulticastGroup method to join the multicast group.

If a network adapter was specified to the BindServiceNameAsync method, only groups on networks present on the specified adapter will be joined.

An app receiving multicast packets may also need to deal with network adapter changes. If network connectivity changes and the local computer or device is assigned a different IP address, the app needs to rejoin the multicast group.

Applies to