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

◆ begin_send() [3/3]

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

xtd::net::sockets::udp_client::sends a datagram to a remote host asynchronously. The destination was specified previously by a call to xtd::net::sockets::udp_client::connect.

Parameters
dgramA byte array that contains the data to be sent.
bytesThe number of bytes to send.
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 completes. To block until the operation is complete, use one of the xtd::net::sockets::udp_client::send method overloads.