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。

範例

下列程式代碼範例會使用 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 會設定物件可以對因特網資源進行的連線數目 ServicePoint 上限。 屬性的值ConnectionLimit會在建立物件時ServicePoint設定為ServicePointManager.DefaultConnectionLimit屬性值;後續變更對DefaultConnectionLimit現有ServicePoint對象沒有任何影響。

適用於

另請參閱