語言

PingOptions.DontFragment 屬性

定義

取得或設定一個 Boolean 值,控制傳送到遠端主機的資料碎片化。

public:
 property bool DontFragment { bool get(); void set(bool value); };
public bool DontFragment { get; set; }
member this.DontFragment : bool with get, set
Public Property DontFragment As Boolean

屬性值

true 若資料無法分多個封包傳送;否則 false。 預設值為 false。

範例

以下程式碼範例示範如何使用 PingOptions 建構子設定此屬性的值,然後顯示該值。

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

Console.WriteLine ("Time to live: {0}", options.Ttl);
Console.WriteLine ("Don't fragment: {0}", options.DontFragment);

備註

應用程式利用此特性來控制類別傳送至遠端主機 Ping 的資料是否能被分割成多個封包。 如果你想測試用於傳輸封包的路由器和閘道器的最大傳輸單元(MTU)時,這個選項非常有用。 若此特性為 , true 且傳送至遠端主機的資料大於傳送端與遠端主機間閘道器或路由器的 MTU 大小,則 ping 操作會失敗,狀態 PacketTooBig為 。

適用於