This documentation is archived and is not being maintained.

ServicePoint.ConnectionLimit Property

Gets or sets the maximum number of connections allowed on this ServicePoint.

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

Property Value

The maximum number of connections allowed on this ServicePoint.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The connection limit is 0 or less than 0.

Remarks

The ConnectionLimit property sets the maximum number of connections that the ServicePoint can make to an Internet resource. The value of the ConnectionLimit property is set to the value of the ServicePointManager.DefaultConnectionLimit property when the ServicePoint is created; subsequent changes to DefaultConnectionLimit have no effect on existing ServicePoint instances.

Example

[Visual Basic, C#, C++] The following example uses the ConnectionLimit property to check the maximum number of connections that the ServicePoint can make to the specified URI.

[Visual Basic] 
Console.WriteLine(("ConnectionName = " + sp.ConnectionName))

' Display the maximum number of connections allowed on this 
' ServicePoint instance.
Console.WriteLine(("ConnectionLimit = " + sp.ConnectionLimit.ToString()))

' Display the number of connections associated with this 
' ServicePoint instance.
Console.WriteLine(("CurrentConnections = " + sp.CurrentConnections.ToString()))


[C#] 
Console.WriteLine ("ConnectionName = " + sp.ConnectionName);

// Display the maximum number of connections allowed on this 
// ServicePoint instance.
Console.WriteLine ("ConnectionLimit = " + sp.ConnectionLimit);

// Display the number of connections associated with this 
// ServicePoint instance.
Console.WriteLine ("CurrentConnections = " + sp.CurrentConnections);


[C++] 
Console::WriteLine(S"ConnectionName = {0}", sp->ConnectionName);

// Display the maximum number of connections allowed on this 
// ServicePoint instance.
Console::WriteLine(S"ConnectionLimit = {0}", __box(sp->ConnectionLimit));

// Display the number of connections associated with this 
// ServicePoint instance.
Console::WriteLine(S"CurrentConnections = {0}", __box(sp->CurrentConnections));        

[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 | Managing Connections

Show: