List out all Network adapters with IP addresses

Hello all first post here!

Im still very new too c++, I currently work as a Sys Adm (Internal IT) and unfortunately we have to take on fixing bugs on internal software or in my case making a band aid.

Essentially we have a program that runs as a service that binds to the current active network adapter and IP it has(apparently we cannot just lock to 127.0.0.1 due to bugs in java). So the problem we are having is that every time a user switches networks that service is bound to the wrong IP and the services bombs out when you try to start the program. The fix is to just restart the service. Easy enough but apparently thats too much for our users.

What I would like to do is create a program/service that will check all the adapters on a windows xp or 7 computer and than compare it to its previous check. If it was the same the program would sleep for X amount of time, if it was different it would stop and that start the service. Now I have the if statement to control the stop and start. What I am unsure about is what method or means would be best to compare a old and present state of the network adapters. I was looking into using this: http://msdn.microsoft.com/en-us/library/aa365915%28v=vs.85%29.aspx
But I have no idea how to implement it. As I said im pretty new too cpp but this is something that will greatly help out my team and I and will be a good project for me.

EDIT: I was thinking about dumping ipconfig /all into a text file, converting it to a string (I think thats possible?) and than compare it to another string in the same manner. I assume this is not a good way to do it but that was my cheap way.

Thanks in advance!
Dylan
Last edited on
Topic archived. No new replies allowed.