|
-
Jul 23rd, 2008, 05:06 AM
#1
Thread Starter
Lively Member
[SOLVED] [2008] Ip Checker
Do somone have a code:
Button1 Click...etc..
check ip code
write IP in textbox 1
Last edited by blt950; Jul 23rd, 2008 at 09:38 AM.
-
Jul 23rd, 2008, 06:38 AM
#2
Re: [2008] Ip Checker
To get the local IPs, you can do something like this:
Code:
Dim s As String = System.Net.Dns.GetHostName()
Dim IPEntry As IPHostEntry = System.Net.Dns.GetHostEntry(s)
Dim IPAdds As IPAddress() = IPEntry.AddressList
For Each IPAdd As IPAddress In IPAdds
TextBox1.Text &= IPAdd.ToString() & Environment.NewLine
Next
To get the external facing IDs, you will have to use a service out on the net. My example uses whatismyip.com, but make sure to read their automation page before you just start using their service.
Code:
Dim wc As New System.Net.WebClient()
Dim enc As New System.Text.ASCIIEncoding
TextBox1.Text = enc.GetString(wc.DownloadData("http://whatismyip.com/automation/n09230945.asp"))
-
Jul 23rd, 2008, 09:37 AM
#3
Thread Starter
Lively Member
Re: [2008] Ip Checker
 Originally Posted by Negative0
To get the local IPs, you can do something like this:
Code:
Dim s As String = System.Net.Dns.GetHostName()
Dim IPEntry As IPHostEntry = System.Net.Dns.GetHostEntry(s)
Dim IPAdds As IPAddress() = IPEntry.AddressList
For Each IPAdd As IPAddress In IPAdds
TextBox1.Text &= IPAdd.ToString() & Environment.NewLine
Next
To get the external facing IDs, you will have to use a service out on the net. My example uses whatismyip.com, but make sure to read their automation page before you just start using their service.
Code:
Dim wc As New System.Net.WebClient()
Dim enc As New System.Text.ASCIIEncoding
TextBox1.Text = enc.GetString(wc.DownloadData("http://whatismyip.com/automation/n09230945.asp"))
Thx.. It helped and works
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
|