Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ServicePoint.MaxIdleTime Property

Gets or sets the amount of time the ServicePoint can remain idle (unconnected to a host).

[Visual Basic]
Public Property MaxIdleTime As Integer
[C#]
public int MaxIdleTime {get; set;}
[C++]
public: __property int get_MaxIdleTime();
public: __property void set_MaxIdleTime(int);
[JScript]
public function get MaxIdleTime() : int;
public function set MaxIdleTime(int);

Property Value

The length of time, in milliseconds, that the ServicePoint can remain idle before it is reused for another connection.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException MaxIdleTime is set to less than Timeout.Infinite or greater than Int32.MaxValue.

Remarks

The MaxIdleTime property contains the length of time, in milliseconds, that the ServicePoint is allowed to maintain an idle connection to an Internet resource before it is recycled for use in another connection.

You can set MaxIdleTime to Timeout.Infinite to indicate that the ServicePoint should never timeout.

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

Example

[Visual Basic, C#, C++] The following example uses the MaxIdleTime property to set and retrieve the ServicePoint idle time.

[Visual Basic] 
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' 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 = " + sp.MaxIdleTime.ToString()))


[C#] 
// Display the date and time that the ServicePoint was last 
// connected to a host.
Console.WriteLine ("IdleSince = " + sp.IdleSince.ToString ());

// 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 = " + sp.MaxIdleTime);


[C++] 
// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine(S"IdleSince = {0}", __box(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(S"MaxIdleTime = {0}", __box(sp->MaxIdleTime));

[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

ServicePoint Class | ServicePoint Members | System.Net Namespace

Show:
© 2015 Microsoft