Gets or sets the maximum number of ServicePoint objects to maintain at any time.
Assembly: System (in System.dll)
'Declaration Public Shared Property MaxServicePoints As Integer 'Usage Dim value As Integer value = ServicePointManager.MaxServicePoints ServicePointManager.MaxServicePoints = value
When you reduce the property below the number of ServicePoint objects currently in existence, the ServicePointManager deletes the ServicePoint objects with the longest idle times. If the number of ServicePoint objects with active connections is greater than the value of , the ServicePointManager object deletes the ServicePoint objects as they become idle.
The following code example sets this property.
' Set the maximum number of ServicePoint instances to maintain. ' Note that, 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. 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. 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::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. ServicePointManager::MaxServicePointIdleTime = 1000;
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.