获取与Cocoa一起使用的所有可用网络接口的列表(en0,en1,en2等)? [英] Get a list of all available network interfaces (en0, en1, en2, etc) with Cocoa?

查看:35
本文介绍了获取与Cocoa一起使用的所有可用网络接口的列表(en0,en1,en2等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Cocoa应用程序中,我想向用户显示可用网络接口的列表,就像Wireshark一样:

In my Cocoa application I want to show the user a list of available network interfaces, like Wireshark does:

获取此类列表的最佳方法是什么?Apple是否为此提供了框架,还是我必须使用标准库或其他库中的C API?

What is the best way of getting such a list? Does Apple provide a framework for this, or must I use a C API from the standard library or another library?

推荐答案

比包装ifconfig更好,您应该检查作为Core Foundation一部分的SCNetworkConfiguration的引用.

Better than wrapping ifconfig you shall check the reference of SCNetworkConfiguration which is part of Core Foundation.

检查SCNetworkInterfaceXxx函数以获取详细信息.

Check SCNetworkInterfaceXxx functions for details.

这篇关于获取与Cocoa一起使用的所有可用网络接口的列表(en0,en1,en2等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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