IReplyChannel.BeginTryReceiveRequest Method (TimeSpan, AsyncCallback, Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Begins an asynchronous operation to receive a request message that has a specified time out and state object associated with it.

Namespace:   System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

IAsyncResult BeginTryReceiveRequest(
	TimeSpan timeout,
	AsyncCallback callback,
	object state


Type: System.TimeSpan

The TimeSpan that specifies how long the receive request operation has to complete before timing out and returning false.

Type: System.AsyncCallback

The AsyncCallback delegate that receives the notification of the asynchronous receive that a request operation completes.

Type: System.Object

An object, specified by the application, that contains state information associated with the asynchronous receive of a request operation.

Return Value

Type: System.IAsyncResult

The IAsyncResult that references the asynchronous receive request operation.

Use the asynchronous BeginTryReceiveRequest(TimeSpan, AsyncCallback, Object) method when you need the application processing to continue without waiting. Use one of the synchronous TryReceiveRequest(TimeSpan, RequestContext) methods when it is acceptable for the current thread to be blocked while it replies to the request message or until the timeout interval is exceeded.

This method receives notification, through a callback, of the identity of the event handler for the operation. The operation is not complete until either a message becomes available in the channel or the time out occurs.

Notes to Implementers:

The operation returns false if the specified timeout is exceeded.

The following code illustrates how to implement this method:

public IAsyncResult BeginTryReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
    TryReceiveRequestAsyncResult result = new TryReceiveRequestAsyncResult(this, timeout, callback, state);
    return result;

.NET Framework
Available since 3.0
Return to top