ServicePoint.ConnectionLimit 属性

定义

获取或设置此 ServicePoint 对象上允许的最大连接数。

public:
 property int ConnectionLimit { int get(); void set(int value); };
public int ConnectionLimit { get; set; }
member this.ConnectionLimit : int with get, set
Public Property ConnectionLimit As Integer

属性值

ServicePoint 对象上允许的最大连接数。

例外

连接限制为 0 或小于 0。

示例

下面的代码示例使用 ConnectionLimit 属性检查对象可以与指定的统一资源标识符 (URI) 建立的最大连接ServicePoint数。

Console::WriteLine( "ConnectionName = {0}", sp->ConnectionName );

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

// Display the number of connections associated with this 
// ServicePoint instance.
Console::WriteLine( "CurrentConnections = {0}", sp->CurrentConnections );
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);
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()))

注解

属性 ConnectionLimit 设置对象可以与 Internet 资源建立的最大连接 ServicePoint 数。 创建对象时ServicePointConnectionLimit 属性的值设置为 属性的值ServicePointManager.DefaultConnectionLimit;后续更改对DefaultConnectionLimit现有ServicePoint对象没有影响。

适用于

另请参阅