|
-
May 17th, 2007, 03:17 AM
#1
Re: What is my IP address?
 Originally Posted by dilettante
Here is a demo that does it programmatically both ways. I hope it doesn't drive anyone batty trying to make sense of the code.
Short answer: an external web site is much easier, much less code. Though you need to hard-code an external URL and tailored parsing logic you only need to do it once.
Asking the NAT router is not only a lot of work but you need a URL (or at least a page) hard coded along with parsing logic for every different router. It's more work because you have to discover the NAT router to ask it... unless you do hard-code the entire URL.
Of course the URLs and parsing "bracket" strings can be parameterized fairly simply. The demo shows this clearly. Note that the "ask your NAT" part of the demo won't work unless you insert values that fit your own router into the demo form. Otherwise it will return the Local IP marked as "questionable."
Exactly, it's completely insane to try and get it from the router's control panel when every manufacturer is different, and to make it even harder, a lot of them require authentication before giving you access to the IP.
You can do it in one line with the Inet control, a few lines with winsock, and a lot more with the winsock API.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|