public class ServicePointManager
Object
ServicePointManager
System
Networking
Manages ServicePoint instances.
ServicePointManager creates, maintains, and deletes ServicePoint instances.When an application requests a connection to an Internet resource through the ServicePointManager, the ServicePointManager returns a ServicePoint instance containing connection information for the host identified by the Uniform Resource Identifier (URI) of the resource. If there is an existing ServicePoint for that host, the ServicePointManager returns the existing ServicePoint, otherwise the ServicePointManager creates a new ServicePoint instance.
System.Net Namespace
ServicePointManager Methods
ServicePointManager.FindServicePoint(System.Uri) Method
ServicePointManager.FindServicePoint(System.String, System.Net.IWebProxy) Method
ServicePointManager.FindServicePoint(System.Uri, System.Net.IWebProxy) Method
ServicePointManager Fields
ServicePointManager.DefaultNonPersistentConnectionLimit Field
ServicePointManager.DefaultPersistentConnectionLimit Field
ServicePointManager Properties
ServicePointManager.DefaultConnectionLimit Property
ServicePointManager.MaxServicePointIdleTime Property
ServicePointManager.MaxServicePoints Property
public static ServicePoint FindServicePoint(Uri address);
Finds an existing ServicePoint or creates a new ServicePoint to connect to the specified host.
- address
- A Uri containing the Internet host to contact.
A ServicePoint that connects to the host identified in address .
Exception Type Condition ArgumentNullException address is null
.InvalidOperationException The maximum number of service points defined in System.Net.ServicePointManager.MaxServicePoints has been reached and there is no service point that connects to the specified host.
This method is identical to System.Net.ServicePointManager.FindServicePoint(System.Uri)(address, System.Net.GlobalProxySelection.GetEmptyWebProxy).If no ServicePoint exists for the host named in address , the ServicePointManager attempts to create one.
System.Net.ServicePointManager Class, System.Net Namespace
public static ServicePoint FindServicePoint(string uriString, IWebProxy proxy);
Finds an existing ServicePoint or creates a new ServicePoint to connect to the specified host.
- uriString
- A String containing a URI that names the host to contact.
- proxy
- A IWebProxy that represents a proxy server to access.
A ServicePoint that connects to the host identified in uriString .
Exception Type Condition ArgumentNullException uriString is null
.UriFormatException The URI specified in uriString is in an invalid form. InvalidOperationException The maximum number of service points defined in System.Net.ServicePointManager.MaxServicePoints has been reached and there is no service point that connects to the specified host.
This method is identical to System.Net.ServicePointManager.FindServicePoint(System.Uri)(new Uri(uriString), proxy).If no ServicePoint exists for the host named in uriString, the ServicePointManager attempts to create one.
System.Net.ServicePointManager Class, System.Net Namespace
public static ServicePoint FindServicePoint(Uri address, IWebProxy proxy);
Finds an existing ServicePoint or creates a new ServicePoint to connect to the specified host.
- address
- A Uri instance containing the address of the Internet resource to contact.
- proxy
- A IWebProxy that represents a proxy server to access.
A ServicePoint that connects to the host identified in address .
Exception Type Condition ArgumentNullException address is null
.InvalidOperationException The maximum number of service points defined in System.Net.ServicePointManager.MaxServicePoints has been reached and there is no service point that connects to the specified host.
If no ServicePoint exists for the System.Uri.Host specified in address , the ServicePointManager attempts to create one.
System.Net.ServicePointManager Class, System.Net Namespace
public const int DefaultNonPersistentConnectionLimit = 4;
The default number of non-persistent connections allowed on a ServicePoint .
This field is read-only.The value of this field is 4.
System.Net.ServicePointManager Class, System.Net Namespace
public const int DefaultPersistentConnectionLimit = 2;
The default number of persistent connections allowed on a ServicePoint .
This field is read-only.The value of this field is 2.
System.Net.ServicePointManager Class, System.Net Namespace
public static int DefaultConnectionLimit { get; set; }
Gets or sets the maximum number of concurrent connections allowed by a ServicePoint instance.
A Int32 containing the maximum number of concurrent connections allowed by a ServicePoint instance.
Exception Type Condition ArgumentOutOfRangeException The value specified for a set operation is less than or equal to zero.
The System.Net.ServicePointManager.DefaultConnectionLimit property sets the default maximum number of concurrent connections that the ServicePointManager assigns to the System.Net.ServicePoint.ConnectionLimit property when creating ServicePoint instances.[Note: Changing the System.Net.ServicePointManager.DefaultConnectionLimit property has no effect on existing ServicePoint instances; it affects only ServicePoint instances that are initialized after the change.]
System.Net.ServicePointManager Class, System.Net Namespace
public static int MaxServicePointIdleTime { get; set; }
Gets or sets the maximum amount of time a ServicePoint instance can be idle, after which resources allocated to the service point can be released.
A Int32 containing the maximum idle time, in milliseconds, of a ServicePoint instance.
Exception Type Condition ArgumentOutOfRangeException The value specified for a set operation is less than System.Threading.Timeout.Infinite or greater than System.Int32.MaxValue
A ServicePoint is idle when the list of connections associated with the ServicePoint is empty.The System.Net.ServicePointManager.MaxServicePointIdleTime property holds the value for the maximum idle time for service points. When a ServicePoint instance is created, this value is assigned to its System.Net.ServicePoint.MaxIdleTime property. Changes to the value of this property affect only ServicePoint instances that are initialized after this property is changed.
After a ServicePoint has been idle for the time specified in System.Net.ServicePoint.MaxIdleTime , it is released by the service point manager, and any resources allocated for it are freed.
The default value of this property is implementation defined.
System.Net.ServicePointManager Class, System.Net Namespace
public static int MaxServicePoints { get; set; }
Gets or sets the maximum number of ServicePoint instances managed by this class at any time.
A Int32 containing the maximum number of ServicePoint instances to maintain.
Exception Type Condition ArgumentOutOfRangeException The value specified for a set operation is less than zero or greater than System.Int32.MaxValue
If this property is set to a value that is less than the number of ServicePoint instances currently in existence, the ServicePointManager deletes the ServicePoint instances with the longest idle times. If the number of ServicePoint instances with active connections is greater than the value of System.Net.ServicePointManager.MaxServicePoints, the ServicePointManager deletes ServicePoint instances as they become idle.[Note: The default value of the System.Net.ServicePointManager.MaxServicePoints property is 0, which indicates there is no limit to the number of ServicePoint instances.]
System.Net.ServicePointManager Class, System.Net Namespace