ServicePoint.MaxIdleTime-Eigenschaft
Ruft die Zeitspanne ab, für die eine dem ServicePoint-Objekt zugeordnete Verbindung im Leerlauf bleiben kann, bevor die Verbindung geschlossen wird, oder legt diese fest.
Namespace: System.Net
Assembly: System (in system.dll)
Syntax
'Declaration
Public Property MaxIdleTime As Integer
'Usage
Dim instance As ServicePoint
Dim value As Integer
value = instance.MaxIdleTime
instance.MaxIdleTime = value
public int MaxIdleTime { get; set; }
public:
property int MaxIdleTime {
int get ();
void set (int value);
}
/** @property */
public int get_MaxIdleTime ()
/** @property */
public void set_MaxIdleTime (int value)
public function get MaxIdleTime () : int
public function set MaxIdleTime (value : int)
Eigenschaftenwert
Die Zeitdauer in Millisekunden, die sich eine dem ServicePoint-Objekt zugeordnete Verbindung im Leerlauf befinden kann, bevor sie geschlossen wird und für eine andere Verbindung erneut verwendet wird.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
MaxIdleTime ist auf einen Wert festgelegt, der kleiner als Timeout.Infinite oder größer als Int32.MaxValue ist. |
Hinweise
Sie können MaxIdleTime auf Timeout.Infinite festlegen, um anzugeben, dass für eine dem ServicePoint-Objekt zugeordnete Verbindung kein Timeout erfolgen soll.
Der Standardwert der MaxIdleTime-Eigenschaft ist der Wert der ServicePointManager.MaxServicePointIdleTime-Eigenschaft beim Erstellen des ServicePoint-Objekts. Nachfolgende Änderungen der MaxServicePointIdleTime-Eigenschaft wirken sich nicht auf vorhandene ServicePoint-Objekte aus.
Wenn die MaxIdleTime für eine Verbindung, die einem ServicePoint zugeordnet ist, überschritten wird, bleibt die Verbindung geöffnet, bis die Anwendung versucht, die Verbindung zu verwenden. Zu diesem Zeitpunkt schließt das Framework die Verbindung und erstellt eine neue Verbindung zum Remotehost.
Beispiel
Im folgenden Codebeispiel wird mit der MaxIdleTime-Eigenschaft die ServicePoint-Leerlaufzeit festgelegt und abgerufen.
' 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()))
// 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 = {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.get_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.get_MaxIdleTime()));
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
ServicePoint-Klasse
ServicePoint-Member
System.Net-Namespace