System.Net.ServicePoint Class

Assembly: System.dll
Namespace: System.Net
Summary
Provides connection management for HTTP connections.
C# Syntax:
public class ServicePoint
Remarks
The ServicePoint class handles connections to an Internet resource based on the host information passed in the resource's URI. The initial connection to the resource determines the information the ServicePoint maintains, which is then shared by all subsequent requests to that resource.

ServicePoint instances are managed by the ServicePointManager class and are created, if necessary, by the ServicePointManager.FindServicePoint method. The maximum number of ServicePoint instances that can be created is set by the ServicePointManager.MaxServicePoints property.

Each ServicePoint instance maintains its connection to an Internet resource until it has been idle longer than the time specified in the ServicePoint.MaxIdleTime property. Once a ServicePoint exceeds the ServicePoint.MaxIdleTime, it can be recycled to another connection. The default value of ServicePoint.MaxIdleTime is set by the ServicePointManager.MaxServicePointIdleTime property.

Example
The following example creates a ServicePoint instance connecting to the URI www.contoso.com.
Uri myUri = new Uri("http://www.contoso.com/");
 
 ServicePoint mySP = ServicePointManager.FindServicePoint(myUri);
   

    
See also:
System.Net Namespace

System.Net.ServicePoint Member List:

Public Properties
Address Read-only

Gets the URI of the ServicePoint.
ConnectionLimit Read-write

Gets or sets the maximum number of connections allowed on this ServicePoint.
ConnectionName Read-only

Gets the connection group name established by the WebRequest that created the connection.
CurrentConnections Read-only

Gets the number of connections associated with this ServicePoint.
IdleSince Read-only

Gets the date and time that the ServicePoint was last connected to a host.
MaxIdleTime Read-write

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

Gets the version of the HTTP protocol that the ServicePoint uses.
SupportsPipelining Read-only

Indicates whether the ServicePoint supports pipelined connections.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode Overridden:
Gets the hash code for the ServicePoint.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Net.ServicePoint Member Details

Property: Address (read-only)
Summary
Gets the URI of the ServicePoint.
C# Syntax:
public Uri Address {get;}

Return to top


Property: ConnectionLimit (read-write)
Summary
Gets or sets the maximum number of connections allowed on this ServicePoint.
C# Syntax:
public int ConnectionLimit {get; set;}
Exceptions
Exception Type Condition
ArgumentOutOfRangeException The connection limit is 0 or less than 0.
Remarks
The ServicePoint.ConnectionLimit property sets the maximum number of connections that the ServicePoint can make to an Internet resource. The value of the ServicePoint.ConnectionLimit property is set to the value of the ServicePointManager.DefaultConnectionLimit property when the ServicePoint is created; subsequent changes to ServicePointManager.DefaultConnectionLimit have no effect on existing ServicePoint instances.
See also:
MSDN: managingconnections

Return to top


Property: ConnectionName (read-only)
Summary
Gets the connection group name established by the WebRequest that created the connection.
C# Syntax:
public string ConnectionName {get;}
Remarks
The ServicePoint.ConnectionName property contains the connection group assigned to the WebRequest.ConnectionGroupName property of the WebRequest that initiated the connection provided by this ServicePoint. If the ServicePoint.ConnectionName property is set, only WebRequest instances with the same WebRequest.ConnectionGroupName can use this ServicePoint.
See also:
MSDN: connectiongrouping

Return to top


Property: CurrentConnections (read-only)
Summary
Gets the number of connections associated with this ServicePoint.
C# Syntax:
public int CurrentConnections {get;}
Remarks
The ServicePoint.CurrentConnections property contains the number of active Internet connections associated with this ServicePoint. The value of ServicePoint.CurrentConnections cannot exceed that of ServicePoint.ConnectionLimit.

Return to top


Property: IdleSince (read-only)
Summary
Gets the date and time that the ServicePoint was last connected to a host.
C# Syntax:
public DateTime IdleSince {get;}
Remarks
The ServicePoint.IdleSince property records the last date and time at which a service point was disconnected from a host. When the difference between the current time and ServicePoint.IdleSince exceeds the value of ServicePoint.MaxIdleTime, the ServicePoint is available for recycling to another connection.

Return to top


Property: MaxIdleTime (read-write)
Summary
Gets or sets the amount of time the ServicePoint can remain idle (unconnected to a host).
C# Syntax:
public int MaxIdleTime {get; set;}
Exceptions
Exception Type Condition
ArgumentOutOfRangeException ServicePoint.MaxIdleTime is set to less than Timeout.Infinite and greater than Int32.MaxValue.
Remarks
The ServicePoint.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 ServicePoint.MaxIdleTime to Timeout.Infinite to indicate that the ServicePoint should never timeout.

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

Return to top


Property: ProtocolVersion (read-only)
Summary
Gets the version of the HTTP protocol that the ServicePoint uses.
C# Syntax:
public virtual Version ProtocolVersion {get;}

Return to top


Property: SupportsPipelining (read-only)
Summary
Indicates whether the ServicePoint supports pipelined connections.
C# Syntax:
public bool SupportsPipelining {get;}

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~ServicePoint();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: GetHashCode()
Summary
Gets the hash code for the ServicePoint.
C# Syntax:
public override int GetHashCode();
Return Value:
The hash code for the ServicePoint.
Remarks
The hash code for ServicePoint A and B is the same if A.Equals(B) is true.

This method implements the Object.GetHashCode method.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.