Solved

Determine my IP as seen from outside world

Posted on 2011-03-18
7
581 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 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
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Capture logon name 13 75
Filter IP range with PowerShell 1 41
Can't ping New Linux Servers 40 69
Internet Protocol Security question 3 78
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

825 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