UdpClient.JoinMulticastGroup Method (IPAddress)
Adds a UdpClient to a multicast group.
Assembly: System (in System.dll)
The underlying Socket has been closed.
An error occurred when accessing the socket. See the Remarks section for more information.
The IP address is not compatible with the AddressFamily value that defines the addressing scheme of the socket.
The UdpClient to a multicast group using the specified IPAddress. After calling the method, the underlying Socket sends an Internet Group Management Protocol (IGMP) packet to the router requesting membership to the multicast group. The multicast address range is 184.108.40.206 to 220.127.116.11. If you specify an address outside this range or if the router to which the request is made is not multicast enabled, UdpClient will throw a SocketException. If you receive a SocketException, use SocketException.ErrorCode to obtain the specific error code. Once you have obtained this code, you can refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error. Once the UdpClient is listed with the router as a member of the multicast group, it will be able to receive multicasted datagrams sent to the specified IPAddress.method subscribes the
You must create the UdpClient using the multicast port number; otherwise, you will not be able to receive multicasted datagrams. Do not call the Connect method prior to calling the method, or the Receive method will not work. You do not need to belong to a multicast group to send datagrams to a multicast IP address.
Before joining a multicast group, make sure the socket is bound to the port or endpoint. You do that by calling one of the constructors that accept a port or an endpoint as a parameter.
In the IPv6 case, there are several multicast address ranges you can choose from. Please, refer to the IETF RFC 2375.
Available since 10
Available since 1.1