0

Hi

I wonder if anyone can help?

I am new to Visual Web Developer and .NET I am trying to get the pc name from its IP, I have code to get ip from pc name :

Protected Sub DNSLookup(ByVal IPAddress As String)

        Try

            'performs the DNS lookup
            Dim returnvalue = ""
            Dim he As IPHostEntry = Dns.GetHostEntry(IPAddress)
            Dim ip_addrs As IPAddress() = he.AddressList

            txtIPs.Text = ""
            For Each ip As IPAddress In ip_addrs
                txtIPs.Text = ip.ToString()

            Next ip
        Catch ex As System.Exception

            lblStatus.Text = ex.ToString()
        End Try



    End Sub

But I want it the other way around, can anyone help please?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by sknake
0

Are you trying to get the PC Name or the DNS Hostname of an IP Address? They are two different things and you will only be able to sometimes get the pc name if they are on your LAN. If you are trying to get the DNS name of the IP and your code is not working please post the error message.

Also -- Use code tags in the future when you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.