This documentation is archived and is not being maintained.

ServicePoint::MaxIdleTime Property

Gets or sets the amount of time a connection associated with the ServicePoint object can remain idle before the connection is closed.

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

property int MaxIdleTime {
	int get ();
	void set (int value);

Property Value

Type: System::Int32
The length of time, in milliseconds, that a connection associated with the ServicePoint object can remain idle before it is closed and reused for another connection.


MaxIdleTime is set to less than Timeout::Infinite or greater than Int32::MaxValue.

You can set MaxIdleTime to Timeout::Infinite to indicate that a connection associated with the ServicePoint object should never time out.

The default value of the MaxIdleTime property is the value of the ServicePointManager::MaxServicePointIdleTime property when the ServicePoint object is created. Subsequent changes to the MaxServicePointIdleTime property have no effect on existing ServicePoint objects.

When the MaxIdleTime for a connection associated with a ServicePoint is exceeded, the connection remains open until the application tries to use the connection. At that time, the Framework closes the connection and creates a new connection to the remote host.

The following code example uses the MaxIdleTime property to set and retrieve the ServicePoint idle time.

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.