Export (0) Print
Expand All

ServicePointManager.MaxServicePointIdleTime Property

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

Namespace: System.Net
Assembly: System (in system.dll)

public static int MaxServicePointIdleTime { get; set; }
/** @property */
public static int get_MaxServicePointIdleTime ()

/** @property */
public static void set_MaxServicePointIdleTime (int value)

public static function get MaxServicePointIdleTime () : int

public static function set MaxServicePointIdleTime (value : int)

Property Value

The maximum idle time, in milliseconds, of a ServicePoint object. The default value is 100,000 milliseconds (100 seconds).

Exception typeCondition

ArgumentOutOfRangeException

MaxServicePointIdleTime is less than Timeout.Infinite or greater than Int32.MaxValue.

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

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

The following code example sets this property.

// 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 = 10000;


// 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.set_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.set_MaxServicePointIdleTime(10000);

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, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft