Solved

Determine my IP as seen from outside world

Posted on 2011-03-18
7
577 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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
Cisco Firewall setup within a managed office 8 76
What type of checksum is used for Cisco/Linksys RV router configurations? 18 65
IP Calculator 10 56
Martian Packets Unix 5 31
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 …
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

920 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

15 Experts available now in Live!

Get 1:1 Help Now