ServicePointManager.MaxServicePoints プロパティ
同時に維持される ServicePoint インスタンスの最大数を取得または設定します。
Public Shared Property MaxServicePoints As Integer
[C#]
public static int MaxServicePoints {get; set;}
[C++]
public: __property static int get_MaxServicePoints();public: __property static void set_MaxServicePoints(int);
[JScript]
public static function get MaxServicePoints() : int;public static function set MaxServicePoints(int);
プロパティ値
維持される ServicePoint インスタンスの最大数。既定値は 0 です。これは ServicePoint インスタンスの数に制限がないことを示します。
例外
例外の種類 | 条件 |
---|---|
ArgumentOutOfRangeException | MaxServicePoints が 0 未満か、 Int32.MaxValue を超える値です。 |
解説
MaxServicePoints プロパティを現在の ServicePoint インスタンス数未満に設定すると、 ServicePointManager はアイドル時間が最も長い ServicePoint インスタンスを削除します。アクティブな接続を持つ ServicePoint インスタンスの数が MaxServicePoints の値を超える場合、 ServicePointManager はアイドル状態になった ServicePoint インスタンスを削除します。
使用例
[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 ファミリ, Common Language Infrastructure (CLI) Standard
参照
ServicePointManager クラス | ServicePointManager メンバ | System.Net 名前空間