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

◆ udp_client() [4/6]

xtd::net::sockets::udp_client::udp_client ( xtd::net::sockets::address_family  address_Family)
explicit

Initializes a new instance of the xtd::net::sockets::udp_client class.

Parameters
address_familyone of the xtd::net::sockets::address_family values that specifies the addressing scheme of the socket.
Exceptions
xtd::argument_exceptionfamily is not xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6.
xtd::net::sockets::socket_exceptionAn error occurred when attempting to access the underlying socket.
Remarks
The family parameter determines whether the listener uses an IP version 4 address (IPv4) or an IP version 6 (IPv6) address. To use an IPv4 address, pass the xtd::net::sockets::address_family::inter_network value. To use an IPv6 address, pass the xtd::net::sockets::address_family::inter_network_v6 value. Passing any other value will cause the method to throw an xtd::argument_exception.
If this constructor is used, the xtd::net::sockets::udp_client instance is set with the address family specified by the family parameter that cannot be changed or overwritten by a connect method call with a different address family.
Note
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.
Remarks
The xtd::net::sockets::udp_client.xtd::net::sockets::udp_client(xtd::net::sockets::address_family) is not suitable for joining a multicast group because it does not perform socket binding.