inexcitus
inexcitus

Reputation: 2649

Get Model Identifier of Device in Network

I have a couple of Apple devices in my network (both computers and mobile devices). I was wondering if it is possible, to get the model identifier like Macmini9,1 if I have the IP address and/or the Mac address.

I am using the NetServiceBrowser and NetService classes to find the devices. If the device has the AirPlay service, I can get the model identifier.

However, not all of my devices seem to implement/publish this service (it requires devices running Monterey or later and only devices 2018+ are supported). Is there a more general approach?

I saw that some apps can also get additional information from any device in the network (like the vendor name). How is it possible to get this information in a Swift based app?

macOS seems to know this information. In the Finder a specific icon is shown, so I guess the model identifier must be published somehow:

Devcies in Finder

Update:

It seems like this information can be gathered using a Bonjour service called _device-info._tcp.

I have the following code:

let service = NetService(domain: "", type: "_device-info._tcp", name: "Mac-Mini.local.")
service.delegate = self
service.startMonitoring()

I tried a specific domain ("local.") and various names (Mac-Mini, Mac-Mini.local, Mac-Mini.fritz.box) but I did not get any TXT message.

I updated the Info.plist and added the key.

Does this still work on Ventura? (well it must be, since Finder still shows the icon).

Upvotes: 1

Views: 578

Answers (2)

inexcitus
inexcitus

Reputation: 2649

I solved the problem by using a NetService.

Upvotes: 0

Caleb
Caleb

Reputation: 125037

I saw that some apps can also get additional information from any device in the network (like the vendor name).

One way to get that information is from a lookup service such as macaddress.io, maclookup.app, etc. Vendors can have a range of MAC addresses assigned to them, so it's possible to determine the vendor from the address.

Upvotes: -1

Related Questions