DontFragment Property

Socket.DontFragment Property


Gets or sets a Boolean value that specifies whether the Socket allows Internet Protocol (IP) datagrams to be fragmented.

Namespace:   System.Net.Sockets
Assembly:  System (in System.dll)

member DontFragment : bool with get, set

Property Value

Type: System.Boolean

true if the Socket allows datagram fragmentation; otherwise, false. The default is true.

Exception Condition

This property can be set only for sockets in the InterNetwork or InterNetworkV6 families.


An error occurred when attempting to access the socket. See the Remarks section for more information.


The Socket has been closed.

Datagrams require fragmentation when their size exceeds the Maximum Transfer Unit (MTU) of the transmission medium. Datagrams may be fragmented by the sending host (all Internet Protocol versions) or an intermediate router (Internet Protocol Version 4 only). 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.

Setting this property on a Transmission Control Protocol (TCP) socket will have no effect.

The following code example demonstrates the use of the DontFragment property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft