Name of Wifi Network

Is it possible to get the name of the Wifi network one is connected to in Xojo?

Reason: iPad app and Desktop app need to connect. Won’t work if they’re not on the same network.

don’t you just need to make sure the first 3 triplets of the IP address match?

198.102.64.xxx (or what ever?)

For macOS, see this thread. A reply in that thread also mentions using WMI under Windows, but does not include sample code.

MBS also has the data available, if you use MBS (and IMHO everyone should…) See

For iOS, I used to use code to get this in non-Xojo apps, but more recent OS versions blocked it…

Hi @Bob Gordon - I have some old code kicking around that can do this for both Mac and Windows. What OS are you running for your Desktop app?

Hello Kimball,

I expect most of our users will be on Windows, but most of our testers are on Macs.

-Bob

And the SSID won’t necessarily answer this either. You could have multiple SSID’s that can connect to each other, and you can have an SSID that is the same but intraLan connections are blocked. (As is or should be typical of public Wifi such as hotels, venues, coffee shops, etc)

That would only determine if on the same subnet if the subnet mask was 255.255.255.0 – and while that is true in many cases, it is not necessarily true. But even if you consider the subnet – or the SSID name – that does not necessarily mean they can communicate.

I have used obj-C code to get the SSID name to show in an About box, along with the device IP and the public IP, but just as an aid in tech support. And then iOS started blocking access to the SSID name …

I had a quick gander at my old code: Turns out for both OS’s I just drop to a shell and use built in tools.

On OS X, you can use this command to see the currently connected WiFi network:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
(run it without the -I for lots more info)

On Windows, I use

netsh wlan
Again, you’ll want to play with this command to get it to show you exactly what you are looking for. From within Xojo, start up a shell, run the command for the OS you are on, and parse the results from the shell object.

Thanks to everyone for suggestions/code.

I’ll be trying somethings.

One major problem: Everything works fine here (in Minneapolis). Tester on Long Island and in Albuquerque report a problem. I suppose this makes life more exciting.

@Bob Gordon — After some researches, for my own curiosity, it seems that the common current ways are:

On macOS: use the CWInterface object which allows you to get the SSID but also to scan networks for a given SSID (from 10.6)

On iOS: the current way is to use the NEHotspotHelper object to get the SSID (from iOS 9)