Bagikan melalui


ServicePoint.IdleSince Properti

Definisi

Mendapatkan tanggal dan waktu objek ServicePoint terakhir kali tersambung ke host.

public:
 property DateTime IdleSince { DateTime get(); };
public DateTime IdleSince { get; }
member this.IdleSince : DateTime
Public ReadOnly Property IdleSince As DateTime

Nilai Properti

Objek DateTime yang berisi tanggal dan waktu saat objek ServicePoint terakhir tersambung.

Contoh

Contoh kode berikut menggunakan properti IdleSince untuk mengatur dan mengambil tanggal dan waktu objek ServicePoint terakhir tersambung ke host.

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

Keterangan

Hati

WebRequest, HttpWebRequest, ServicePoint, dan WebClient usang, dan Anda tidak boleh menggunakannya untuk pengembangan baru. Gunakan HttpClient sebagai gantinya.

Properti IdleSince mencatat tanggal dan waktu terakhir saat titik layanan terputus dari host. Ketika perbedaan antara waktu saat ini dan IdleSince melebihi nilai MaxIdleTime, objek ServicePoint tersedia untuk didaur ulang ke koneksi lain.

Berlaku untuk