MessageQueue.EndPeek Method (IAsyncResult)
Completes the specified asynchronous peek operation.
Assembly: System.Messaging (in System.Messaging.dll)
BeginPeek can specify a time-out, which causes the PeekCompleted event to be raised if the time-out occurs before a message appears in the queue. When a time-out occurs without a message arriving in the queue, a subsequent call to throws an exception.
PeekCompleted event to be raised.is used to read the message that caused the
If you want to continue to asynchronously peek messages, you can again call BeginPeek after calling .
The following table shows whether this method is available in various Workgroup modes.
Local computer and direct format name
Remote computer and direct format name
The following code example creates an event handler named MyPeekCompleted, attaches it to the PeekCompleted event handler delegate, and calls BeginPeek to initiate an asynchronous peek operation on the queue that is located at the path ".\myQueue". When a PeekCompleted event is raised, the example peeks the message and writes its body to the screen. The example then calls BeginPeek again to initiate a new asynchronous peek operation.
Available since 1.1