You don’t need to do this to communicate with a remote peer. Our high-level APIs, like NSURLSession
and Network framework, already include path MTU code.
However, if you want to do it for some other reason, it should be feasible. The standard approach is to send a large UDP packet with the DF bit set and then monitor the incoming ICMP responses. If you get a ‘was fragmented’ ICMP, you adjust the size and retry.
The only weird part about this is monitoring ICMP responses. To do that without escalating privileges you need to use an IPPROTO_ICMP
socket. See the SimplePing sample code for the details.
can I acquire this value from some cached storage per connection ?
I’m not sure. What sort of connection are you talking about here?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"