ServicePointManager.MaxServicePointIdleTime プロパティ

定義

ServicePoint オブジェクトの最大アイドル時間を取得または設定します。

public:
 static property int MaxServicePointIdleTime { int get(); void set(int value); };
public static int MaxServicePointIdleTime { get; set; }
static member MaxServicePointIdleTime : int with get, set
Public Shared Property MaxServicePointIdleTime As Integer

プロパティ値

ServicePoint オブジェクトのミリ秒単位の最大アイドル時間。 既定値は 100,000 ミリ秒 (100 秒) です。

例外

次のコード例では、このプロパティを設定します。

// 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 = 10000;
// 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 = 10000;
' 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 = 10000

注釈

プロパティは MaxServicePointIdleTime 、オブジェクトの作成時にオブジェクトが ServicePointManager プロパティに MaxIdleTime 割り当てる最大アイドル時間を ServicePoint 設定します。 この値の変更は、値が変更された後に初期化されるオブジェクトにのみ ServicePoint 影響します。

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

適用対象

こちらもご覧ください