Export (0) Print
Expand All

IReplyChannel.BeginReceiveRequest Method (TimeSpan, AsyncCallback, Object)

Begins an asynchronous operation to receive an available request with a specified timeout.

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

IAsyncResult BeginReceiveRequest(
	TimeSpan timeout,
	AsyncCallback callback,
	Object state
)

Parameters

timeout
Type: System.TimeSpan

The Timespan that specifies the interval of time to wait for the reception of an available request.

callback
Type: System.AsyncCallback

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

state
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 reception of the request.

The BeginReceiveRequest(TimeSpan, AsyncCallback, Object) method implements the standard pattern for invoking ReceiveRequest(TimeSpan)asynchronously. The timeout set on this method overrides a receive timeout set on the binding that is used to configure the connection.

If the request message received is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. The maximum message size is set by the MaxReceivedMessageSize property. The default value is 65536 bytes.

The following code illustrates how to implement this method:

public IAsyncResult BeginReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
{
    ReceiveRequestAsyncResult result = new ReceiveRequestAsyncResult(this, timeout, callback, state);
    result.Begin();
    return result;
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft