开发者

Measure network traffic programmatically on iPhone

开发者 https://www.devze.com 2023-01-27 19:41 出处:网络
I\'m interested in mea开发者_如何学运维suring the network traffic for my application. Ideally I would need to separate wireless from 3G network traffic. I can\'t seem to find any API that gets this in

I'm interested in mea开发者_如何学运维suring the network traffic for my application. Ideally I would need to separate wireless from 3G network traffic. I can't seem to find any API that gets this information; however I see that there is at least one app in the AppStore that does something close (they actually sum up the traffic for the entire phone).

Any ideas?


I've found one approximate solution: getifaddrs can be used to get statistics on network usage.

One advantage is that it can get separate statistics for Wi-Fi and WWAN interfaces.

A disadvantage is that on multi-tasking devices those interfaces may be used by multiple applications and the statistics are cumulated.


I also was looking for solution and found it here: iPhone Data Usage Tracking/Monitoring

Please take a look this post, it provides all info that you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消