Sends a datagram to a destination asynchronously. The destination is specified by the host name and port number.
- datagram
- A byte array that contains the data to be sent.
- bytes
- The number of bytes to send.
- hostname
- The destination host.
- port
- The destination port number.
- 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, string, 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 is complete. 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.