Hello everyone,
We have a use case where we need to disable the sending and receiving of fragmented packets on the network while using NWConnection.
However, even after setting the disableFragmentation flag to true, the connection still sends fragmented packets.We’ve tried setting the flag as follows, but the packets are still being fragmented:
var connection : NWConnection
var udp_options : NWProtocolUDP.Optionsudp_options = NWProtocolUDP.Options()
var connection_parameters = NWParameters(dtls: nil, udp: udp_options)
let ip_options = connection_parameters.defaultProtocolStack.internetProtocol! as! NWProtocolIP.Options
ip_options.disableFragmentation = true
connection = NWConnection (host: "XX.XX.XX.***", port: NWEndpoint.Port(25000), using: connection_parameters)
The issue we are encountering is that even though we’ve set disableFragmentation
to true
on the sender, the receiver still receives fragmented UDP packets. This can be observed using Wireshark, where we are sending a 10k byte data from the sender and receiving the fragmented datagram packets on the receiver end while both the devices are on the same WiFi network. Additionally, Wireshark shows that the packet has the "DF" bit set to '0', indicating that fragmentation is allowed.
What is exactly expected from the disableFragmentation
flag? Are we misunderstanding how this flag works? Or is there something else we should be doing to ensure that fragmentation is completely disabled?
Looking forward to your insights!