16,014,952 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Dennis Dykstra (Top 3 by date)
Dennis Dykstra
20-Sep-11 20:31pm
View
Deleted
Thanks. It's helpful to know how the browser gets the IP address; I had assumed there was some way it could get that information locally. I have my own website to which I've added an IP Address page somewhat like yours, so I can query it in code by using a method similar to Method 2 above and Alternative 4 below. I've been curious about this for a long time because I had assumed there should be some way to get the router's external IP address from within a local network. Ping, tracert, and pingback don't work even though someone once told me that there is some way to force them to reveal the calling IP address. I've tried all of the arguments and none of them provides that information.
Dennis Dykstra
20-Sep-11 15:42pm
View
Deleted
Oh, yes, the website works fine. The browser object has the correct external IP address, and that's what the website returns, as does the one suggested by Walt Fair. But I don't know of any way to get the external IP address from within a local-area network, such as a home network. I've often wondered how you do that. It must be possible, since the browser object has that information when it accesses external web pages, but I've never seen any code that could get it.
Dennis Dykstra
19-Sep-11 18:50pm
View
Deleted
These are not equivalent. Alternatives 1 and 2 by DrABELL (and the related one by Walt Fair) provide the external IP address. The code suggested by Mohammad Rahman provides only internal IP addresses--those that are visible within the local network. On my computer, that code produces two IP addresses, 192.168.0.5 and its exact IPv6 equivalent, fe80::246b:1153:32d9:e133%10. As far as I have ever been able to determine, you cannot get your external IP address from code if you're behind a router; at least I've never found any code that will do it for my computer. I'd be interested if anyone knows of any such code.