Export (0) Print
Expand All

ServicePointManager.MaxServicePointIdleTime Property

Gets or sets the maximum idle time of a ServicePoint instance.

[Visual Basic]
Public Shared Property MaxServicePointIdleTime As Integer
[C#]
public static int MaxServicePointIdleTime {get; set;}
[C++]
public: __property static int get_MaxServicePointIdleTime();
public: __property static void set_MaxServicePointIdleTime(int);
[JScript]
public static function get MaxServicePointIdleTime() : int;
public static function set MaxServicePointIdleTime(int);

Property Value

The maximum idle time, in milliseconds, of a ServicePoint instance.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException MaxServicePointIdleTime is less than Timeout.Infinite or greater than Int32.MaxValue

Remarks

The MaxServicePointIdleTime property sets the maximum idle time that the ServicePointManager assigns to the MaxIdleTime property when creating ServicePoint instances. Changes to this value will affect only ServicePoint instances that are initialized after the value is changed.

After a ServicePoint has been idle for the time specified in MaxIdleTime, it is eligible for garbage collection. A ServicePoint is idle when the list of connections associated with the ServicePoint is empty.

Default value is 900,000 milliseconds (15 minutes).

Example

[Visual Basic, C#, C++] The following example sets this property.

[Visual Basic] 
' Set the maximum number of ServicePoint instances to maintain.
' Note that, if a ServicePoint instance for that host already 
' exists when your application requests a connection to
' an Internet resource, the ServicePointManager object
' returns this existing ServicePoint. If none exists 
' for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4

' Set the maximum idle time of a ServicePoint instance to 10 seconds.
' After the idle time expires, the ServicePoint object is eligible for
' garbage collection and cannot be used by the ServicePointManager.
ServicePointManager.MaxServicePointIdleTime = 1000


[C#] 
// Set the maximum number of ServicePoint instances to 
// maintain. If a ServicePoint instance for that host already 
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists 
// for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager object.
ServicePointManager.MaxServicePointIdleTime = 1000;


[C++] 
// Set the maximum number of ServicePoint instances to 
// maintain. If a ServicePoint instance for that host already 
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists 
// for that host, it creates a new ServicePoint instance.
ServicePointManager::MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager.
ServicePointManager::MaxServicePointIdleTime = 1000;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

ServicePointManager Class | ServicePointManager Members | System.Net Namespace

Show:
© 2014 Microsoft