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)

member MaxIdleTime : int with get, set

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.

Exception Condition
ArgumentOutOfRangeException

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: