01-20-2014 11:19 AM
Hi, all,
for my user interface application (communicate with the control system via some external LWIP library) would be very useful know if the host network card is able (that means is properly configured) to communicate with desired IP address.
I have a idea to use GetAllTCPHostAddresses () function - and obtain the available IP host interfaces. But how to get the appropriate IP subnet mask for each interface?
Any hint will be appreciated!
Thanks,
George
Solved! Go to Solution.
01-21-2014 02:26 AM - edited 01-21-2014 02:27 AM
There is a good example written by NickB here: it retrieves and prints the default gateway and IP address. You can print the subnet mask by adding this line to PrintAdapterInfo () function:
printf (" IP subnet mask: %s\n\n", adapterInfo->IpAddressList.IpMask.String);
You need to add IPHlpApi.Lib to the project in order to use run it.
There are a lot of useful informations offered by IP Helper APIs: the only problem is that you need full CVI package to use them. If you have the base package you may consider to call ipconfig redirecting the output to a file, next parsing the output file. See later in the discussion I linked above.
01-21-2014 04:18 AM
Hi, Roberto,
that's just what I wanted, thank's a lot!
Now I have tested and it's work good.
Cheers,
George
01-21-2014 04:45 AM
I'm happy to have helped you finding the correct information in the forum.
I have kudoed Nick post which really is the solution to your problem and it's a good example of how to use these functions.