System.Net.ServicePoint.MaxIdleTime Property

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

Syntax

public int MaxIdleTime { get; set; }

Value

A int containing the number of milliseconds that a System.Net.ServicePoint can remain idle before it is released by the System.Net.ServicePointManager and subsequently freed.

Exceptions

TypeReason
ArgumentOutOfRangeExceptionThe value specified for a set operation is less than System.Threading.Timeout.Infinite or greater than int.MaxValue.

Remarks

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

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

When the ServicePoint.MaxIdleTime for a connection associated with a System.Net.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.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0