finding ip address with c++ (cross platform)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 8
Reputation: kaleshwar is an unknown quantity at this point 
Solved Threads: 0
kaleshwar kaleshwar is offline Offline
Newbie Poster

finding ip address with c++ (cross platform)

 
0
  #1
Jun 21st, 2008
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?
Last edited by kaleshwar; Jun 21st, 2008 at 5:23 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,502
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: finding ip address with c++ (cross platform)

 
0
  #2
Jun 21st, 2008
There are a couple cross-platform libraries that I am aware of

1) GNU Common C++

2) DataReel
Last edited by Ancient Dragon; Jun 21st, 2008 at 12:35 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC