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

◆ udp_client() [3/6]

xtd::net::sockets::udp_client::udp_client ( const xtd::net::ip_end_point local_end_point)
explicit

Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the specified local endpoint.

Parameters
local_end_pointAn xtd::net::ip_end_point that represents the local endpoint to which you bind the UDP connection.
Exceptions
xtd::net::sockets::socket_exceptionAn error occurred when attempting to access the underlying socket.
Remarks
This constructor creates a new xtd::net::sockets::udp_client and binds it to the xtd::net::ip_end_point specified by the local_end_point parameter. Before you call this constructor, you must create an xtd::net::ip_end_point using the IP address and port number from which you intend to send and receive data. You do not need to specify a local IP address and port number for sending and receiving data. If you do not, the underlying service provider will assign the most appropriate local IP address and port number.
If this constructor is used, the xtd::net::sockets::udp_client instance is set with the address family specified by the local_end_point 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.