相关疑难解决方法(0)

iPhone数据使用跟踪/监控

我搜索了这个主题,但发现很少有帮助的细节.有了这些细节,我试着按如下方式编写一些代码.

注意:请将此帖中分享的详细信息与其他帖子进行比较,然后再将其标记为DUPLICATE,而不仅仅是主题.

- (NSArray *)getDataCountersForType:(int)type {
    BOOL success;
    struct ifaddrs *addrs = nil;
    const struct ifaddrs *cursor = nil;
    const struct sockaddr_dl *dlAddr = nil;
    const struct if_data *networkStatisc = nil; 

    int dataSent = 0;
    int dataReceived = 0;

    success = getifaddrs(&addrs) == 0;
    if (success) {
        cursor = addrs;
        while (cursor != NULL) {
            if (cursor->ifa_addr->sa_family == AF_LINK) {
                dlAddr = (const struct sockaddr_dl *) cursor->ifa_addr;
                networkStatisc = (const struct if_data *) cursor->ifa_data;

                if (type == WiFi) {
                    dataSent …
Run Code Online (Sandbox Code Playgroud)

sockets iphone ios

135
推荐指数
4
解决办法
5万
查看次数

如何在iOS设备上跟踪3G/wifi上的网络流量?

我试图理解像DataMan这样的应用程序是如何工作的.即使它在后台运行,它如何衡量其他应用程序的带宽分配?

background bandwidth ios

15
推荐指数
1
解决办法
2959
查看次数

标签 统计

ios ×2

background ×1

bandwidth ×1

iphone ×1

sockets ×1