System.Net.Sockets.UdpClient.JoinMulticastGroup Method

Adds a System.Net.Sockets.UdpClient to a multicast group.

Syntax

public void JoinMulticastGroup (System.Net.IPAddress multicastAddr, System.Net.IPAddress localAddress)

Parameters

multicastAddr
The multicast System.Net.IPAddress of the group you want to join.
localAddress
The local System.Net.IPAddress.

Remarks

Before you join a multicast group, be sure that the socket is bound to the port or endpoint. You can do this by calling one of the constructors that accepts a port or an endpoint as parameter.

Note:

There are several multicast address ranges to choose from. You can find them in the IETF RFC 2375.

Note:

You cannot call erload:System.Net.Sockets.UdpClient.JoinMulticastGroup on a System.Net.Sockets.UdpClient constructed without a specific local port (that is, using the UdpClient.#ctor or UdpClient.#ctor(AddressFamily) constructor).

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0