PingReply.Options プロパティ
アセンブリ: System (system.dll 内)
構文Status が Success の場合は、応答の送信に使用する有効期間 (TTL: Time to Live) とフラグメンテーション ディレクティブを格納した PingOptions オブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。
解説TTL は、送信元と送信先の間をパケットが伝送される際にノードがパケットを転送できる回数を定義します。転送の回数 (ホップ数) が、TTL に指定された値を超えた場合、そのパケットは配送不可能と判断され、破棄されます。
ICMP エコー要求に指定される DontFragment の値は、パケットのフラグメンテーションを制御します。DontFragment が true の場合、パケットが通過するネットワーク パスの MTU (Maximum Transmission Unit) をパケット サイズが超えると、そのパケットは破棄され、PacketTooBig エラーが返されます。
使用例ICMP エコー要求を同期的に送信し、このプロパティによって返される PingOptions オブジェクトに格納された値を表示するコード例を次に示します。
public static void LocalPing () { // Ping's the local machine. Ping pingSender = new Ping (); IPAddress address = IPAddress.Loopback; PingReply reply = pingSender.Send (address); if (reply.Status == IPStatus.Success) { Console.WriteLine ("Address: {0}", reply.Address.ToString ()); Console.WriteLine ("RoundTrip time: {0}", reply.RoundtripTime); Console.WriteLine ("Time to live: {0}", reply.Options.Ttl); Console.WriteLine ("Don't fragment: {0}", reply.Options.DontFragment); Console.WriteLine ("Buffer size: {0}", reply.Buffer.Length); } else { Console.WriteLine (reply.Status); } }
プラットフォームWindows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- PingReply.Options プロパティのページへのリンク