My computer has 3 IPs, one internet IP, one local network and one dialup connector. I can get these IPs fine with winsock but how can I distinguish them. I mean, can I get the adapters the IPs are for so that I'll always can get the IP of one adapter. Of course I can check for 192.168.x.x or 0.0.0.0 (for a not connected dialup), but I'm looking for a general solution. Something like winipcfg does (showing each adapter with it's IP). Thomas
Do you have 2 or 3 adapters? You should be able to access the adapter by an interface number.
I have 3 adapters, 2 ethernet cards and one normal modem. What do you mean by interface number? Also I've found some useful functions in the IPhlp library but I haven't got any libs or headers for this API. If anyone would be so kind to send me the LIB and headers (or includes if you have them), I'll put them on my site then. Thomas
Thomas, You can use gethostbyname, which will return a list of adapters available in the HOSTENT structure. Is that what you're after? or you can use RasEnumConnections, then use RasGetConnectionStatus on each handle retrieved.... umbongo
No umbongo, getting the IPs is no problem. The problem is I want to know which network adapter they belong to. I need this for a little client for dyndns.org (gives you domain names that link to your IP), that automatically updates the dyndns account if your IP changes. But to do this I want the user to be able to specify which network adapter's IP to use for the update. As otherwise the program would have no idea which of the IPs to choose, especially when those IPs change all the time. I know I can do a simple filter that checks for the local subnets etc. but I want to do it the right way. I've found some functions in iphlpapi.dll that do exactly what I want but I don't have any headers or libs of this API. Thanks for the reply anyway, Thomas