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

◆ begin_send() [1/3]

xtd::sptr< xtd::iasync_result > xtd::net::sockets::udp_client::begin_send ( const std::vector< xtd::byte > &  dgram,
size_t  bytes,
const xtd::string hostname,
uint16  port,
xtd::async_callback  callback,
const std::any &  state 
)

xtd::net::sockets::udp_client::sends a datagram to a destination asynchronously. The destination is specified by the host name and port number.

Parameters
dgramA byte array that contains the data to be sent.
bytesThe number of bytes to send.
hostnameThe destination host.
portThe destination port number.
callbackAn xtd::async_callback delegate that references the method to invoke when the operation is complete.
stateA user-defined object that contains information about the send operation. This object is passed to the callback delegate when the operation is complete.
Returns
An xtd::iasync_result object that references the asynchronous send.
Remarks
The asynchronous xtd::net::sockets::udp_client::begin_send operation must be completed by calling the xtd::net::sockets::udp_client::end_send method. Typically, the method is invoked by the callback delegate.
This method does not block until the operation is complete. To block until the operation is complete, use one of the xtd::net::sockets::udp_client::send method overloads.