Delen via


DatagramSocketControl.DontFragment Property

Definition

Gets or sets a Boolean value that specifies whether the DatagramSocket allows IP datagrams for UDP to be fragmented.

public:
 property bool DontFragment { bool get(); void set(bool value); };
bool DontFragment();

void DontFragment(bool value);
public bool DontFragment { get; set; }
var boolean = datagramSocketControl.dontFragment;
datagramSocketControl.dontFragment = boolean;
Public Property DontFragment As Boolean

Property Value

Boolean

bool

Whether the DatagramSocket allows datagrams to be fragmented.

true if the DatagramSocket shouldn't fragment datagrams; otherwise, false. The default is false which allows datagrams to be fragmented.

Remarks

The DontFragment property lets your app decide whether the DatagramSocket allows datagrams to be fragmented. The default value is false which allows datagrams to be fragmented.

IP datagrams used by UDP require fragmentation when their size exceeds the Maximum Transfer Unit (MTU) of the network transmission hardware. Datagrams may be fragmented by the sending app or by an intermediate router (IPv4 only). If a datagram must be fragmented, and the DontFragment property is set to true, the datagram is discarded, and an Internet Control Message Protocol (ICMP) error message is sent back to the sender of the datagram.

This property may be set before the DatagramSocket is bound or connected. After the DatagramSocket is bound or connected, setting this property will result in an error.

Applies to

See also