Post

Replies

Boosts

Views

Activity

ifi_ibytes and ifi_obytes from getifaddrs reset at 4GB
Good evening,we have developed an application on iphone that , during background fetch or location change,it analizes traffic data usage on the device.We call getifaddrs() from ifaddrs.h and loop all the ifa_data ("en*" for wifi and "pdp_ip*" for wwan traffic) to calculate the amount of traffic data through the variables ifa_data->ifi_obytes and ifa_data->ifi_oibytes.We know that during reboot the amount of these variable resets and we handle this case. The problem is when the device consume traffic data greater than 4gb, since these variables res, being of type u_int32_t.We also tried to retrieve if_data not like struct if_data but like if_data64(beacuse in this struct the two variable are u_int64_t) but the data retrieved from it is wrong (the values not represent the real traffic data usage).Is there some way to detect to solve this problem and retrieve the exact traffic data consumed from the device? If not, there are other solution, instead of getifaddrs, to retrieve total traffic data usage of the device? We can't intercept in any way when these variable reset for overflow and this problem makes the amount retireved unreliable.I thank you in advance for future responses.Good day and good work.Daniele.
7
0
1.9k
Sep ’18