xtd 0.2.0
Loading...
Searching...
No Matches

◆ join_multicast_group() [4/4]

void xtd::net::sockets::udp_client::join_multicast_group ( const xtd::net::ip_address multicast_address,
const xtd::net::ip_address local_address 
)

Adds a xtd::net::sockets::udp_client to a multicast group.

Parameters
multicast_addressThe multicast xtd::net::ip_address of the group you want to join.
local_addressThe local xtd::net::ip_address.
Exceptions
xtd::net::sockets::socket_exceptionAn error occurred when attempting to access the underlying socket.
xtd::object_closed_exceptionThe underlying xtd::net::sockets::socket has been closed.
Remarks
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.
Note
There are several multicast address ranges to choose from. Refer to the IETF RFC 2375.
You cannot call xtd::net::sockets::udp_client::join_multicast_group on a xtd::net::sockets::udp_client constructed without a specific local port (that is, using the xtd::net::sockets::udp_client() or xtd::net::sockets::udp_client(xtd::net::sockets::address_family) constructor).
If you receive a xtd::net::sockets::socket_exception, use the xtd::net::sockets::socket_exception::error_code property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.