-
Feb 5th, 2012, 07:21 PM
#1
Thread Starter
Member
Alternative Method Of Getting External IP Of System
I found this code below to find the external IP address of the system it is run on, but I was wondering is there another method of finding this information out without the need of using this external website incase it isnt operational anymore.
Code:
Function ExternalIP() As String
Dim WC As New System.Net.WebClient
Return System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://automation.whatismyip.com/n09230945.asp")))
WC.Dispose()
End Function
-
Feb 6th, 2012, 08:35 AM
#2
Re: Alternative Method Of Getting External IP Of System
I too wanted to do this once upon a time. Never figured found a way. I dont think its possible unless your computer is directly connected to the internet. That means not behind a router using NAT. The IP address would be assigned to your computer by your ISP if you're directly connected and you could use the windows API (GetAdapterInfo if memory serves me right) to enumerate your network adapters and retrieve their IP addresses.
-
Feb 6th, 2012, 08:01 PM
#3
Thread Starter
Member
Re: Alternative Method Of Getting External IP Of System
Thanks for the reply, I have read what you said about routers and having them use NAT I think what I want to achieve might me very difficult if not impossible to do. But as stubborn as I am I will keep looking into it and see what I can find. Using the method I mentioned I just feel comfortable using method relying on a web site to be operational to function.
-
Feb 6th, 2012, 09:01 PM
#4
Re: Alternative Method Of Getting External IP Of System
I agree with you. I would hate to have to rely on a website for any function in my apps.
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
|