Hello again,
I'm attempting to get my computers public IP (WAN) and I've used numerous codes suggested from the net and none of them seem to work!
Example #1:
Example #2:
Example #3:
Example #4
When I press Button #3, nothing happens. Nothing. And I tested button 3 with other code to make sure that wasn't the issue and it isn't. If the code(s) should be working, then perhaps it's a router/firewall issue? Any help very much appreciated.
I'm attempting to get my computers public IP (WAN) and I've used numerous codes suggested from the net and none of them seem to work!
Example #1:
Code:
Function GetIpAddress() As String
Dim ip As New WebClient
Return ip.DownloadString("http://automation.whatismyip.com/n09230945.asp")
End Function
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.GetIpAddress().ToString()
MessageBox.Show(GetIpAddress())
End Sub
Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim WC As New System.Net.WebClient
Label2.Text =
System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://whatismyip.com/automation/n09230945.asp")))
WC.Dispose()
End Sub
Code:
'Dim ip() As Net.IPAddress = System.Net.Dns.GetHostAddresses("http://***ismyip.com/text")
'
'If ip.Count > 0 Then
'For Each ipadd As Net.IPAddress In ip
'Console.WriteLine(ipadd.ToString)
'Next
'End If
Code:
'Dim req As HttpWebRequest = WebRequest.Create("http://***ismyip.com/text")
'Dim res As HttpWebResponse = req.GetResponse()
'Dim Stream As Stream = res.GetResponseStream()
'Dim sr As StreamReader = New StreamReader(Stream)
' MessageBox.Show(sr.ReadToEnd())