ServicePointManager.MaxServicePointIdleTime Özellik

Tanım

Nesnenin ServicePoint boşta kalma süresi üst sınırını alır veya ayarlar.

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

Özellik Değeri

Bir ServicePoint nesnenin milisaniye cinsinden boşta kalma süresi üst sınırı. Varsayılan değer 100.000 milisaniyedir (100 saniye).

Özel durumlar

Örnekler

Aşağıdaki kod örneği bu özelliği ayarlar.

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

Açıklamalar

özelliği, MaxServicePointIdleTime nesne oluştururken ServicePoint nesnenin ServicePointManager özelliğine MaxIdleTime atadığı en fazla boşta kalma süresini ayarlar. Bu değerdeki değişiklikler yalnızca ServicePoint değer değiştirildikten sonra başlatılan nesneleri etkiler.

Bir ServicePoint nesne içinde MaxIdleTimebelirtilen süre boyunca boşta kaldığında, atık toplama için uygundur. ServicePoint Nesneyle ServicePoint ilişkilendirilmiş bağlantı listesi boş olduğunda nesne boşta kalır.

Şunlara uygulanır

Ayrıca bkz.