Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to measure packet loss in an iOS app?

I'm building a portion of an app that will require the user to download files of varying size. Currently, I'm using Apple's Reachability code to let me know if I have a connection.
(http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html)

While the reachability code can keep track of 'having a connection', it doesn't have an ability to let me know of a worsening connection. It would seem that I need to expand on the functionality of the Apple code to meet my requirement. Is it possible for me to measure the number or percentage of dropped packets during the data transfer? This would be helpful so I could message the user and be able to pause or stop the download.

like image 933
propstm Avatar asked Sep 18 '25 18:09

propstm


1 Answers

There is no iOS API available that hooks deep into the networking stack that tells you when and why packets are dropped. It could be dropped at a router or it could be dropped locally because of a checksum error.

What kind of data is it? I assume TCP. You might be able to infer the quality of the connection by examining the throughput rate. You can count how many bytes you receive per second.

TCP has something called congestion control and the end hosts (iOS devices) will throttle back their throughput as packets are dropped and go unacknowledged. So throughput may correlate with network quality. However, your throughput rate may vary for many reasons such as network congestion, packet shaping, QoS, etc.

iOS does not have a public API to monitor the wifi signal strength. There is a private API but your app would not be approved in the app store if you use the private API.

like image 141
jaybers Avatar answered Sep 21 '25 09:09

jaybers