ServicePoint.MaxIdleTime Vlastnost

Definice

Získá nebo nastaví dobu, po kterou připojení přidružené k objektu ServicePoint může zůstat nečinné před ukončením připojení.

public:
 property int MaxIdleTime { int get(); void set(int value); };
public int MaxIdleTime { get; set; }
member this.MaxIdleTime : int with get, set
Public Property MaxIdleTime As Integer

Hodnota vlastnosti

Doba v milisekundách, po kterou může připojení přidružené k objektu ServicePoint zůstat nečinné, než se zavře a znovu použije pro jiné připojení.

Výjimky

MaxIdleTime je nastavená na hodnotu menší než Infinite nebo větší než Int32.MaxValue.

Příklady

Následující příklad kódu používá MaxIdleTime vlastnost k nastavení a načtení doby nečinnosti ServicePoint .

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );
// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

Poznámky

Nastavením na Timeout.Infinite můžete MaxIdleTime označit, že připojení přidružené k objektu ServicePoint by nikdy nemělo vypršovat časový limit.

Výchozí hodnota MaxIdleTime vlastnosti je hodnota ServicePointManager.MaxServicePointIdleTime vlastnosti při vytvoření objektu ServicePoint . Následné změny MaxServicePointIdleTime vlastnosti nemají žádný vliv na existující ServicePoint objekty.

MaxIdleTime Pokud je překročena hodnota pro připojení přidružená ServicePoint k, zůstane připojení otevřené, dokud se aplikace nepokusí připojení použít. V té době rozhraní ukončí připojení a vytvoří nové připojení ke vzdálenému hostiteli.

Platí pro