UdpClient.DontFragment Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Property Value
true
if the UdpClient doesn't allow datagram fragmentation; otherwise, false
. The default is true
.
Exceptions
This property can be set only for sockets that use the InterNetwork flag or the InterNetworkV6 flag.
Examples
The following code example shows the use of the DontFragment property.
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 );
}
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);
}
Remarks
Datagrams require fragmentation when their size exceeds the Maximum Transfer Unit (MTU) of the transmission medium. Datagrams may be fragmented by the sending host or by an intermediate router. If a datagram must be fragmented, and the DontFragment option is set, the datagram is discarded, and an Internet Control Message Protocol (ICMP) error message is sent back to the sender of the datagram.