Click here to Skip to main content
15,885,278 members

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.