ServicePoint.MaxIdleTime プロパティ

定義

ServicePoint オブジェクトに関連付けられた接続がアイドル状態を持続できる時間を取得または設定します。この時間が経過すると、接続は閉じられます。

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

プロパティ値

ServicePoint オブジェクトに関連付けられた接続が閉じられて別の接続で再利用されるまでにアイドル状態を持続できる時間 (ミリ秒単位)。

例外

MaxIdleTimeInt32.MaxValue より小さいInfiniteか、より大きいに設定されています。

次のコード例では、 プロパティを MaxIdleTime 使用してアイドル時間を設定および取得します ServicePoint

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );
// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

注釈

を にTimeout.Infinite設定MaxIdleTimeすると、オブジェクトに関連付けられている接続がServicePointタイムアウトになることはありません。

プロパティの MaxIdleTime 既定値は、オブジェクトの作成時の ServicePointManager.MaxServicePointIdleTime プロパティの ServicePoint 値です。 プロパティに対する後続の MaxServicePointIdleTime 変更は、既存 ServicePoint のオブジェクトには影響しません。

MaxIdleTimeに関連付ServicePointけられている接続の を超えた場合、アプリケーションが接続の使用を試みるまで、接続は開いたままです。 その時点で、フレームワークは接続を閉じ、リモート ホストへの新しい接続を作成します。

適用対象