0
我有以下的代碼來獲取我的MacBook上的所有適配器列表getifaddrs()在雨燕未發現:迅雷以太網適配器使用
if getifaddrs(&addresses) == 0
{
let buffer = UnsafeBufferPointer(start: addresses, count: 16)
for address in buffer
{
let rawData = address.ifa_data
let name = address.ifa_name
let socket: sockaddr = address.ifa_addr.pointee
if rawData != nil && name != nil && socket.sa_family == UInt8(AF_LINK)
{
let adapterName = String(utf8String: UnsafePointer<CChar>(name!))
let adapter = Adapter(name: adapterName!)
adapters.append(adapter)
}
}
}
代碼的偉大工程,(幾乎)所有適配器返回。如果使用Thunderbolt to Ethernet適配器,則不會返回此網絡。
如何獲得此適配器?
謝謝,我會試試。 –