次の方法で共有


ServicePoint.IdleSince プロパティ

ServicePoint が最後にホストに接続した日付と時刻を取得します。

Public ReadOnly Property IdleSince As DateTime
[C#]
public DateTime IdleSince {get;}
[C++]
public: __property DateTime get_IdleSince();
[JScript]
public function get IdleSince() : DateTime;

プロパティ値

ServicePoint が最後に接続した日付と時刻を格納している DateTime インスタンス。

解説

IdleSince プロパティは、サービス ポイントが最後にホストから切断された日付と時刻を記録します。現在の時刻と IdleSince との間の差が MaxIdleTime の値を超えている場合、 ServicePoint は別の接続で再利用できます。

使用例

[Visual Basic, C#, C++] IdleSince プロパティを使用して、 ServicePoint が最後にホストに接続した日付と時刻を設定および取得する例を次に示します。

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


[C#] 
// 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);


[C++] 
// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine(S"IdleSince = {0}", __box(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(S"MaxIdleTime = {0}", __box(sp->MaxIdleTime));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

ServicePoint クラス | ServicePoint メンバ | System.Net 名前空間