I am writing code that heuristically determines the likelihood that a service will reside on a network interface. The hardware I'm looking for does not implement SSDP or mDNS, so I have to look for it manually.
The device connects to the network via WiFi, so most likely I will find it through the WiFi interface. However, it is possible that the Mac will be connected to the Wi-Fi bridge via Ethernet, so this can very well be resolved through this.
To avoid unnecessary requests and to be a generally good citizen of the network, I would like to be smart with which interface to try first.
I can get a list of interfaces on my computer without problems, but this is not useful: en0- wired ethernet on my iMac, but WiFi on my Macbook.
Bonus points if this works on iOS as well, although it is rarely possible to use a USB USB adapter with it.
source
share