读取接收和发送的网络流量字节 [英] Read network traffic bytes received and sent

查看:158
本文介绍了读取接收和发送的网络流量字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Objective-C中获取网络流量发送和接收字节的最简单方法是什么?

What is the easiest way to get the network traffic sent and received bytes in Objective-C?

推荐答案

这并不容易,它来自C语言而不是Objective-C,但是您所需的所有信息都存储在由以下方法返回给您的接口地址的ifa_data字段中 getifaddrs(3).您可以在中查看如何访问此示例的示例.源代码到libtop_p_networks_sample函数中的"top"实用程序.

It's not easy, and it's from C not Objective-C, but all the info you need is stored in the ifa_data field of the interface addresses returned to you by getifaddrs(3). You can see one example of how to access this in the source code to the 'top' utility, in the libtop_p_networks_sample function.

这篇关于读取接收和发送的网络流量字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆