Saturday, December 15, 2007

Tip: How to get IP address of your Windows Mobile device

How do I know if my Windows Mobile device is connected to the Internet and if so, what is its IP address?
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
      Dim hostName As String = Dns.GetHostName()
      Dim currenthost As IPHostEntry = Dns.GetHostEntry(hostName)
      Return currenthost.AddressList(0).ToString() <> _
   Catch ex As Exception
      Return False
   End Try
End Function

1 comment:

Ayman said...

Thanks for this post. I have tried it, it only shows "" .. Is there any way to find the private IP Address?