次の方法で共有


ServicePointManager.MaxServicePointIdleTime プロパティ

ServicePoint インスタンスの最大アイドル時間を取得または設定します。

Public Shared Property MaxServicePointIdleTime As Integer
[C#]
public static int MaxServicePointIdleTime {get; set;}
[C++]
public: __property static int get_MaxServicePointIdleTime();public: __property static void set_MaxServicePointIdleTime(int);
[JScript]
public static function get MaxServicePointIdleTime() : int;public static function set MaxServicePointIdleTime(int);

プロパティ値

ServicePoint インスタンスのミリ秒単位の最大アイドル時間。

例外

例外の種類 条件
ArgumentOutOfRangeException MaxServicePointIdleTimeTimeout.Infinite より小さい値か、 Int32.MaxValue より大きい値です。

解説

MaxServicePointIdleTime プロパティは、 ServicePoint インスタンスの作成時に ServicePointManagerMaxIdleTime プロパティに割り当てる最大アイドル時間を設定します。この値への変更は、値が変更された後に初期化される ServicePoint インスタンスだけに影響を与えます。

ServicePoint のアイドル時間が MaxIdleTime で指定した時間を超えた場合は、ガベージ コレクションの対象となります。 ServicePoint に関連付けられている接続の一覧が空の場合、 ServicePoint はアイドル状態です。

既定値は 900,000 ミリ秒 (15 分) です。

使用例

[Visual Basic, C#, C++] このプロパティを設定する例を次に示します。

 
' Set the maximum number of ServicePoint instances to maintain.
' Note that, if a ServicePoint instance for that host already 
' exists when your application requests a connection to
' an Internet resource, the ServicePointManager object
' returns this existing ServicePoint. If none exists 
' for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4

' Set the maximum idle time of a ServicePoint instance to 10 seconds.
' After the idle time expires, the ServicePoint object is eligible for
' garbage collection and cannot be used by the ServicePointManager.
ServicePointManager.MaxServicePointIdleTime = 1000


[C#] 
// Set the maximum number of ServicePoint instances to 
// maintain. If a ServicePoint instance for that host already 
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists 
// for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager object.
ServicePointManager.MaxServicePointIdleTime = 1000;


[C++] 
// Set the maximum number of ServicePoint instances to 
// maintain. If a ServicePoint instance for that host already 
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists 
// for that host, it creates a new ServicePoint instance.
ServicePointManager::MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager.
ServicePointManager::MaxServicePointIdleTime = 1000;

[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

参照

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