UdpClient.DontFragment 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
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
UdpClient如果 不允許資料報片段,則為 ,否則為 false。 預設為 true。
例外狀況
只可以為使用 InterNetwork 旗標或 InterNetworkV6 旗標的通訊端設定這個屬性。
範例
下列程式代碼範例示範 如何使用 DontFragment 屬性。
public static void GetSetDontFragment(UdpClient u)
{
// Set the don't fragment flag for packets emanating from
// this client.
u.DontFragment = true;
Console.WriteLine("DontFragment value is {0}",
u.DontFragment);
}
備註
當數據報的大小超過傳輸媒體的最大傳輸單位 (MTU) 時,數據報需要分散。 數據報可能會由傳送主機或中繼路由器分散。 如果數據報必須分散,而且 DontFragment 已設定 選項,則會捨棄數據報,並將因特網控制訊息通訊協定 (ICMP) 錯誤訊息傳回給數據報的傳送者。