Determine the local system's ip address

Posted in: General vb.NET
By dePoPo
Mar 16, 2009 - 10:17:49 AM



        ' --- get the ip address of the local system
        Dim s_ipaddr As String = ""
        Dim f As Integer
        Dim ipaddr() As Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList
        For f = 0 To ipaddr.Length - 1
            ' you may get returns like :::1 for non used ipv6 slots. filter them
            If Len(ipaddr(f).ToString) > 4 Then
                s_ipaddr = ipaddr(f).ToString
                MsgBox(s_ipaddr)
            End If
        Next


Visitor Comments