954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

finding ip address with c++ (cross platform)

ok before someone points me to google or to the search box, let me state that I have already done the searching.
The solutions I get either state using winsock(which happens to be windows only):( or parsing the output of ifconfig(which happens to be linux and maybe unix only):( and further has the problem that if the pc is in a network and traffic is routed through a gateway, ifconfig will give localnetwork address, instead of gateway address.

so my question is there any cross platform way of getting ipaddress of local machine "as seen from the web"?
The ip returned should match that given by whatismyip.com and such sites. Or do I just have to bite the bullet here?

kaleshwar
Newbie Poster
8 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

There are a couple cross-platform libraries that I am aware of

1) GNU Common C++

2) DataReel

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You