다음을 통해 공유


ServicePointManager.MaxServicePoints 속성

정의

언제나 유지해야 할 ServicePoint 개체의 최대 개수를 가져오거나 설정합니다.

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

속성 값

유지해야 할 ServicePoint 개체의 최대 개수입니다. 기본값은 0이며, 이는 ServicePoint 개체의 개수에 제한이 없음을 의미합니다.

예외

MaxServicePoints 가 0보다 작거나 Int32.MaxValue보다 큽 수 있습니다.

예제

다음 코드 예제에서는이 속성을 설정합니다.

// 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

설명

현재 존재하는 개체 수 ServicePoint 보다 낮은 속성을 줄 MaxServicePoints 이면 가 ServicePointManager 유휴 시간이 가장 긴 개체를 삭제합니다ServicePoint. 활성 연결이 있는 개체 수가 ServicePointMaxServicePointsServicePointManager 보다 크면 개체는 유휴 상태가 되면 개체를 삭제합니다ServicePoint.

적용 대상

추가 정보