Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IInputChannel.BeginWaitForMessage Method

Begins an asynchronous wait-for-a-message-to-arrive operation that has a specified time out and state object associated with it.

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

IAsyncResult BeginWaitForMessage (
	TimeSpan timeout,
	AsyncCallback callback,
	Object state
)
IAsyncResult BeginWaitForMessage (
	TimeSpan timeout, 
	AsyncCallback callback, 
	Object state
)
function BeginWaitForMessage (
	timeout : TimeSpan, 
	callback : AsyncCallback, 
	state : Object
) : IAsyncResult
Not applicable.

Parameters

timeout

The Timespan that specifies the interval of time to wait for a message to become available.

callback

The AsyncCallback delegate that receives the notification of the asynchronous operation completion.

state

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

Return Value

The IAsyncResult that references the asynchronous operation to wait for a message to arrive.

Exception typeCondition

TimeoutException

The specified timeout is exceeded before the operation is completed.

ArgumentOutOfRangeException

The timeout specified is less than zero.

Use the asynchronous BeginWaitForMessage method if you need the application processing to continue without waiting for the message to arrive. Use the synchronous WaitForMessage method when it is acceptable for the current thread to be blocked while it waits for a message to arrive in the queue. The thread is blocked up to the specified timeout.

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, not a timeout exception.

The following code illustrates how to implement this method:

public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
{
    return this.InnerChannel.BeginWaitForMessage(timeout, callback, state);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft