PingReply.Buffer プロパティ
アセンブリ: System (system.dll 内)


ICMP エコー要求と共に送信されるデータ バッファは、エコー応答で送信元に返されるため、既知のサイズのパケットのラウンドトリップにかかる時間を計算できます。データ バッファは、DontFragment オプションと組み合わせて使用することで、送信元コンピュータと送信先コンピュータの間のネットワーク パスの MTU (Maximum Transmission Unit) を調べることができます。詳細については、http://www.ietf.org から RFC 1574の「Section 3.2 Traceroute」を参照してください。

ICMP エコー要求を同期的に送信し、このプロパティによって返されるバッファのサイズを表示するコード例を次に示します。
public static void ComplexPing () { Ping pingSender = new Ping (); // Create a buffer of 32 bytes of data to be transmitted. string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes (data); // Wait 10 seconds for a reply. int timeout = 10000; // Set options for transmission: // The data can go through 64 gateways or routers // before it is destroyed, and the data packet // cannot be fragmented. PingOptions options = new PingOptions (64, true); // Send the request. PingReply reply = pingSender.Send ("www.contoso.com", timeout, buffer, options); 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.Buffer プロパティのページへのリンク