System.Net.Sockets.UdpClient.BeginSend Method

Sends a datagram to a destination asynchronously. The destination is specified by a System.Net.EndPoint.

Syntax

public IAsyncResult BeginSend (byte[] datagram, int bytes, System.Net.IPEndPoint endPoint, AsyncCallback requestCallback, object state)

Parameters

datagram
A byte array that contains the data to be sent.
bytes
The number of bytes to send.
endPoint
The System.Net.EndPoint that represents the destination for the data.
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, System.Net.IPEndPoint, 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.

Requirements

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