System.Net.Sockets.UdpClient.BeginReceive Method

Receives a datagram from a remote host asynchronously.

Syntax

public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)

Parameters

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 receive operation. This object is passed to the requestCallback delegate when the operation is complete.

Returns

An IAsyncResult object that references the asynchronous receive.

Remarks

The asynchronous UdpClient.BeginReceive(AsyncCallback, object) operation must be completed by calling the UdpClient.EndReceive(IAsyncResult, System.Net.IPEndPoint@) 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 the UdpClient.Receive(System.Net.IPEndPoint@) method.

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