Link to home
Start Free TrialLog in
Avatar of eh936
eh936

asked on

How to get WAN IP Address of Router

Hey everyone I'm new to network and winsock programming so bare with me.

Can anyone show me step by step with source code examples on how to get the WAN IP address of my router using C\C++ and using either Visual C++ 2005 compiler or Borland Command Line Compiler. The source code has to compile please. I've done a search on EE and found this article which is close but I cannot get the code to compile because some of the header files I don't know where to find or where some of the structures are defined.

https://www.experts-exchange.com/questions/20094738/MAC-to-IP-Address-Translation.html?

Thanks

Avatar of tvman_od
tvman_od
Flag of United States of America image

Check this out

http://sourceforge.net/projects/stun/

It's a client which connects to a public STUN servers and detects where the request came from.
You will need to extract usefull parts or compile as a whole thing using instructions inside the package.
ASKER CERTIFIED SOLUTION
Avatar of Adrien de Croy
Adrien de Croy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eh936
eh936

ASKER

AdriendeC:

I was aware of many of the online websites available for determining your own public IP address but did not want to go that route or rely on their service. Thanks for pointing the part of the WAN IP not being on the same subnet this really helps understand everything more clearer. I'm going to look into the SNMP suggestion you had made but if I can't make heads or tail with the sample source being a newbie to network programming and pretty much a newbie programmer I'll try working on the DNS client you talked about.

Thank you