ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Programatically determining your IP Address...

<< < (2/5) > >>

Codebyte:
kk, that will give me somewhere to start... Thanks alot f0dder! Also, is that auto-detection thing a tough implementation? I wouldnt know how to go about doing it...

f0dder:
Doesn't have to be *that* tough - as long as you have libraries that handle HTTP connections and regular expressions.

Basically, fetch a page (for instance http://checkip.dyndns.org/ or http://ip-address.cc/), try to match the Regular Expression you have designed for scraping the IP, and if it succeeds - you have the IP. If you want to code everything by hand, it will be complex. But if you have HTTP and RegEx libraries, it's a pretty quick job.

Codebyte:
Now, only left to do is figure out how to grab a web page's source code programatically.... Once I get this done, ill upload a sample executable to see if the String routine will work correctly with different IP's...

Codebyte:
k, here is a test run... This application should grab the source from http://checkip.dyndns.org/ and use a simple string manipulation to find your external IP address... Please post and let me know the results.

If this doesnt work for everyone thats tries it, im going to set up an algorithm to grab what looks like the ip from a few several sources and perform string manipulation on them all. At the end, ill compare results and come up with a score sheet to make an estimated guess at the most accurate IP address... For now, I simply need feedback on this one...

http://www.codebyter.com/Media/Programs/externalip.exe

mouser:
works well here.  :up:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version