IReplyChannel::BeginTryReceiveRequest Method (TimeSpan, AsyncCallback^, Object^)
Begins an asynchronous operation to receive a request message that has a specified time out and state object associated with it.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
IAsyncResult^ BeginTryReceiveRequest( TimeSpan timeout, AsyncCallback^ callback, Object^ state )
Parameters
- timeout
-
Type:
System::TimeSpan
The TimeSpan that specifies how long the receive request operation has to complete before timing out and returning false.
- 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 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); result.Begin(); return result; }
Available since 3.0