Jump to content

Obter endereço de IP


Recommended Posts

Boas pessoal, eu tenho andado a tentar obter o endereço de IP para cada placa de rede mas não tenho tido sucesso 😉

Aqui está o meu código

Dim iface As NetworkInterface() = GetAllInterfaces()
        Dim i As Integer = 0
        For Each Str As NetworkInterface In iface
            Dim itm As New ListViewItem(i)
            i = i + 1

Prece-me estar tudo OK mas na parte dos IP's aparece-me isto


Link to comment
Share on other sites

Sacar IP's

Public Function GetIp() As String
            Dim IPList As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
            Dim IP As IPAddress
            For Each IP In IPList.AddressList
                'Only return IPv4 routable IPs
                If (IP.AddressFamily = Sockets.AddressFamily.InterNetwork) Then
                    Return IP.ToString
                End If
            Return ""
        Catch ex As Exception
        End Try
    End Function

depois e so representares....

EDIT: GeSHi adicionado

Quando te pedirem peixe.... ensina-os a Pescar!!Hum..lálálálá!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.