Check your internal & external ip
Page 1 of 1
Check your internal & external ip
23:30:29 11.07.2013
Imports System.Net.WebClient
Imports System.Text.RegularExpressions
Public Class Form1
Dim webip As New Net.WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
ipAddresses.Text = "checking your ip wait few second..."
Button1.Enabled = False
Catch
End Try
Dim externalIP As String = Nothing
Try
externalIP = webip.DownloadString("http://checkip.dyndns.org/")
externalIP = New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}").Matches(externalIP)(0).ToString
ipAddresses.Text = ("Internal IP: " _
& (System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).AddressList(0).ToString _
& vbNewLine & (" External IP: " + externalIP)))
Button1.Enabled = True
Catch
ipAddresses.Text = "error! check your internet connection..."
Button1.Enabled = True
End Try
'("Internal IP: " _
' + (System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).AddressList(0).ToString _
'+ (externalIP Is Nothing)))
'TODO: Warning!!!, inline IF is not supported ?
'Warning!!! Lambda constructs are not supported
End Sub
End Class
Imports System.Net.WebClient
Imports System.Text.RegularExpressions
Public Class Form1
Dim webip As New Net.WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
ipAddresses.Text = "checking your ip wait few second..."
Button1.Enabled = False
Catch
End Try
Dim externalIP As String = Nothing
Try
externalIP = webip.DownloadString("http://checkip.dyndns.org/")
externalIP = New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}").Matches(externalIP)(0).ToString
ipAddresses.Text = ("Internal IP: " _
& (System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).AddressList(0).ToString _
& vbNewLine & (" External IP: " + externalIP)))
Button1.Enabled = True
Catch
ipAddresses.Text = "error! check your internet connection..."
Button1.Enabled = True
End Try
'("Internal IP: " _
' + (System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).AddressList(0).ToString _
'+ (externalIP Is Nothing)))
'TODO: Warning!!!, inline IF is not supported ?
'Warning!!! Lambda constructs are not supported
End Sub
End Class
giovhz- Newbie
- Posts : 41
Join date : 2013-03-09
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|