Get Network Interface Type from IP Address

In my JUCE app, I display to the user the IP addresses assigned to their computer with IPAddress::getAllAddresses(). Additionally, I would like to display the type of network interface each IP is assigned to, being either wired (ethernet) or wireless (WiFi).

Lastly, it would be amazing if I could somehow get the WiFi Network name (as seen in the WiFi menus of OSes) of the particular wireless network interface an IP is assigned.

From what I can tell, this interface type & name functionality I am looking for is not in JUCE. Does anyone know a way to achieve this? Preferably a cross-platform solution?


A bit about what I am making and why I am looking for this functionality:
I am making an OSCReceiver app which is to run on a laptop computer. The user of the application will need to connect a separate mobile computing device over the network to communicate with my OSCReceiver on the laptop via the OSC protocol.

I want the connection setup to be as user-friendly as possible. Ideally, this would be automatic, but since OSC operates over UDP, I believe I would have to implement some kind of broadcast/handshake system (maybe over TCP to initiate a connection) which sounds difficult. For now, without implementing an automatic connection scheme, I just want the user to enter the IP address & port number into the mobile OSC app to allow for communication. For the user to know the proper connection information, I simply display the IP and port in the OSCReceiver app and notify them this is the connection information to input into the mobile app.

This sounds simple enough, but when a computer is connected to multiple network interfaces (Ex: one WiFi connection and one ethernet connection), I want the user to easily be able to see which IP Address corresponds to which device, so they can connect the mobile device to the network interface they intend.

Thanks for any help here!

Yes, and yes.

I have a boat load of cross-platform code to check the interface type, and to check when the connection goes up/down (I just don’t have the name since it was never a necessity…). It’s not an entirely easy to assemble. Let me see if I can turn this into an FR and a PR into juce_core for the team to look at.

3 Likes

@jrlanglois That would be awesome thank you! If you get any updates on this, please post here! I would also be interested if you had a public link to the code as well.

I have also stumbled across Bonjour/ZeroConf for automatic network configuration which is used by other OSC apps such as TouchOSC to make an OSC connection automatically, which would be more ideal for my application than displaying IPs and ports.

I also found a forum post which requests Bonjour as a feature in JUCE. I think this would be a great feature. Anyone already using Bonjour with JUCE in a cross platform way? @jrlanglois have you done stuff with Bonjour before?

I haven’t had a reason to play with Bonjour so I’m not totally familiar with it.

1 Like

I ended up finding a lot of information about Bonjour in JUCE on the forums:

Although this Bonjour stuff offers a great solution to my general problem, it would still be super helpful to know how to get network interface types and connected WiFi network names.

Thanks for any help here!