Question: 
How do I know if my Windows Mobile device is connected to the Internet and if so, what is its IP address?
Answer:
Use the following function to determine if you are connected. You can also use this to determine its IP address:
'---check whether you are connected to the Internet---
Private Function IsConnected() As Boolean
   Try
      Dim hostName As String = Dns.GetHostName()
      Dim currenthost As IPHostEntry = Dns.GetHostEntry(hostName)
      Return currenthost.AddressList(0).ToString() <> _
      IPAddress.Loopback.ToString()
   Catch ex As Exception
      Return False
   End Try
End Function
 
1 comment:
Thanks for this post. I have tried it, it only shows "127.0.0.1" .. Is there any way to find the private IP Address?
Thanks,
a.
Post a Comment