System.Net.Sockets.UdpClient.BeginSend Method

Sends a datagram to a remote host asynchronously. The destination was specified previously by a call to erload:System.Net.Sockets.UdpClient.Connect.

Syntax

public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state)

Parameters

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.

Returns

An IAsyncResult object that references the asynchronous send.

Remarks

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.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0