次の方法で共有


ServicePoint.MaxIdleTime プロパティ

ServicePoint がアイドル (ホストに接続していない) 状態でいることができる時間を取得または設定します。

Public Property MaxIdleTime As Integer
[C#]
public int MaxIdleTime {get; set;}
[C++]
public: __property int get_MaxIdleTime();public: __property void set_MaxIdleTime(int);
[JScript]
public function get MaxIdleTime() : int;public function set MaxIdleTime(int);

プロパティ値

ServicePoint が別の接続で再利用されるまでのミリ秒単位のアイドル時間。

例外

例外の種類 条件
ArgumentOutOfRangeException MaxIdleTimeTimeout.Infinite より小さい値か、 Int32.MaxValue より大きい値に設定されています。

解説

MaxIdleTime プロパティは、 ServicePoint が別の接続で再利用されるまでに、インターネット リソースへのアイドル接続を維持できるミリ秒単位の時間を格納します。

MaxIdleTimeTimeout.Infinite に設定して、 ServicePoint がタイムアウトしないことを指定できます。

MaxIdleTime プロパティの既定値は、 ServicePoint の作成時の ServicePointManager.MaxServicePointIdleTime プロパティの値です。後で MaxServicePointIdleTime プロパティを変更しても、既存の ServicePoint インスタンスには影響を与えません。

使用例

[Visual Basic, C#, C++] MaxIdleTime プロパティを使用して、 ServicePoint のアイドル時間を取得および設定する例を次に示します。

 
' 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()))


[C#] 
// 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);


[C++] 
// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine(S"IdleSince = {0}", __box(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(S"MaxIdleTime = {0}", __box(sp->MaxIdleTime));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

ServicePoint クラス | ServicePoint メンバ | System.Net 名前空間