InfiniteTimeout Field
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

MessageQueue.InfiniteTimeout Field

Specifies that no time-out exists for methods that peek or receive messages.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public static readonly TimeSpan InfiniteTimeout
public static final TimeSpan InfiniteTimeout
public static final var InfiniteTimeout : TimeSpan

MessageQueue supports two types of message retrieval: synchronous and asynchronous. The synchronous methods, Peek and Receive, cause the process thread to wait a specified time interval for a new message to arrive in the queue. If the specified time interval is InfiniteTimeout, the process thread remains blocked until a new message is available. On the other hand, BeginPeek and BeginReceive (the asynchronous methods), allow the main application tasks to continue in a separate thread until a message arrives in the queue.

The following code example demonstrates the use of the InfiniteTimeout member.

// Create a new message.
Message msg = new Message();

// Set the message's TimeToReachQueue property to
// MessageQueue.InfiniteTimeout.
msg.TimeToReachQueue = MessageQueue.InfiniteTimeout;

// Display the new value of the message's TimeToReachQueue property.
Console.WriteLine("Message.TimeToReachQueue: {0}",
    msg.TimeToReachQueue.ToString());

// Create a new message.
Message msg = new Message();
// Set the message's TimeToReachQueue property to
// MessageQueue.InfiniteTimeout.
msg.set_TimeToReachQueue(MessageQueue.InfiniteTimeout);
// Display the new value of the message's TimeToReachQueue property.
Console.WriteLine("Message.TimeToReachQueue: {0}", 
    System.Convert.ToString(msg.get_TimeToReachQueue()));

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0
Show:
© 2016 Microsoft