System.Messaging Reference (Document! X Sample)
System.Messaging Namespace / MessageQueue Class / BeginReceive Method / BeginReceive(TimeSpan,Object,AsyncCallback) Method
A System.TimeSpan that indicates the interval of time to wait for a message to become available.
A state object, specified by the application, that contains information associated with the asynchronous operation.
The System.AsyncCallback that will receive the notification of the asynchronous operation completion.



In This Topic
    BeginReceive(TimeSpan,Object,AsyncCallback) Method
    In This Topic
    Initiates an asynchronous receive operation that has a specified time-out and a specified state object, which provides associated information throughout the operation's lifetime. This overload 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 queue or the time-out occurs.
    Syntax
    'Declaration
     
    
    Public Overloads Function BeginReceive( _
       ByVal timeout As TimeSpan, _
       ByVal stateObject As Object, _
       ByVal callback As AsyncCallback _
    ) As IAsyncResult
    'Usage
     
    
    Dim instance As MessageQueue
    Dim timeout As TimeSpan
    Dim stateObject As Object
    Dim callback As AsyncCallback
    Dim value As IAsyncResult
     
    value = instance.BeginReceive(timeout, stateObject, callback)

    Parameters

    timeout
    A System.TimeSpan that indicates the interval of time to wait for a message to become available.
    stateObject
    A state object, specified by the application, that contains information associated with the asynchronous operation.
    callback
    The System.AsyncCallback that will receive the notification of the asynchronous operation completion.

    Return Value

    The System.IAsyncResult that identifies the posted asynchronous request.
    Exceptions
    ExceptionDescription
    The value specified for the timeout parameter is not valid.
    An error occurred when accessing a Message Queuing method.
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also