Solved

Determine my IP as seen from outside world

Posted on 2011-03-18
7
575 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
7 Comments
 
LVL 82

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now