Solved

Determine my IP as seen from outside world

Posted on 2011-03-18
7
598 Views
Last Modified: 2012-06-27
www.ipchicken.com shows my IP address which is dynamic, so I use ipchicken to check it sometimes.  I want to, from a C++ program, determine the same IP address as ipchicken does.
How can I do this?  
0
Comment
Question by:tullhead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35170316
Servers can tell your external IP address from the TCP/IP network connections because the 'source' address is part the process and the server has to know where to send the web page back to.  If you are behind a DSL or cable modem, that IP address doesn't exist on your internal network.  If you have access to the modem admin pages, you may be able to find out what it's external IP address is.  Otherwise, your C++ program would have to connect to an outside source to get that information.
0
 
LVL 3

Accepted Solution

by:
jerbear1337 earned 250 total points
ID: 35170758
My first quick answer is use c++ to do some sort of website grep of whatismyip.com or something similar and then parse the html for you ip address.
0
 
LVL 3

Expert Comment

by:jerbear1337
ID: 35170796
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 1

Expert Comment

by:amulheirn
ID: 35172090
Alternatively (since the external website might change, and that could stop your grep thingy working) you might be able to set up SNMP on your router, and do an SNMP get of the variable that holds the dynamic IP address maybe?  

I guess it depends on the router and whether it is advanced enough to run an SNMP stack though.
0
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 250 total points
ID: 35173861
You can use wget and whatismyip:

    wget www.whatismyip.com/automation/n09230945.asp -O myaddress

The file myaddress will have your address as seen by the outside world.  Or you could write your own C"" code to get the same URL (www.whatismyip.com/automation/n09230945.asp)  and process the response.
0
 

Author Closing Comment

by:tullhead
ID: 35200864
I'm a little worried to build the url

www.whatismyip.com/automation/n09230945.asp

into my application.  There is probably no guarantee that this url will remain stable over the years.....

I have my own server on the net, under my control, could I put some little app there to do whatever it is that whatsmyip is doing?  Then I would control....
0
 
LVL 57

Expert Comment

by:giltjr
ID: 35201835
--> I'm a little worried to build the url

I would not worry about it.

If you go to www.whatismyip.com and look at the page source they have a comment in there telling you to go there.

So they are documenting this as a usable feature.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question