Sends a datagram to a remote host asynchronously. The destination was specified previously by a call to erload:System.Net.Sockets.UdpClient.Connect.
- datagram
- A byte array that contains the data to be sent.
- bytes
- The number of bytes to send.
- requestCallback
- An AsyncCallback delegate that references the method to invoke when the operation is complete.
- state
- A user-defined object that contains information about the send operation. This object is passed to the requestCallback delegate when the operation is complete.
An IAsyncResult object that references the asynchronous send.
The asynchronous UdpClient.BeginSend(Byte[], int, AsyncCallback, object) operation must be completed by calling the UdpClient.EndSend(IAsyncResult) method. Typically, the method is invoked by the requestCallback delegate.
This method does not block until the operation completes. To block until the operation is complete, use one of the erload:System.Net.Sockets.UdpClient.Send method overloads.
For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview.