View Single Post
  #4 (permalink)  
Old 03-03-2009, 11:04 PM
alienation alienation is offline
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Mar 2009
Posts: 6
Reputation: 0
alienation is on a distinguished programming path ahead
Cool Re: Almost same problem

i have a question which may lead to another question, but here's the first...
how can i get the name of the computer/machine using IP address

ex.
the computer's name is alien with ip address 192.168.0.10
now i have a program which pings the network

Try
Dim IncreaseValue As Integer = 1
Dim Ping As New Ping
Dim PingOptions As New PingOptions
PingOptions.Ttl = 64
Dim PingRep As PingReply

While (IncreaseValue <= 256)
Dim IPAddPC = IpAddressPopulate & IncreaseValue.ToString

PingRep = Ping.Send(IPAddPC, 10)
TextBox1.AppendText(PingRep.Status.ToString & " - " & IPAddPC & vbCrLf)
If PingRep.Status = IPStatus.Success Then
ListBox1.Items.Add(IpAddressPopulate & IncreaseValue) ' & " - Computer responded.")
Else
ListBox1.Items.Add(IpAddressPopulate & IncreaseValue) '& " - Computer did not respond.")
End If
IncreaseValue += 1
End While
Catch ex As Exception

End Try

I have another listbox which lists all the ip address that respond to ping.
My problem now is how to retrieve the name of the computers/machines using that IP address. I did use the System.Net.Dns.GetHostEntry(listbox1.selecteditem. tostring).HostName but it returns the value of the ip address and not the name of the computer...

inside the network we also have some network printers that i must also get the information...

kindly help pls...
__________________
"...THe TeLePHoNe NuMBeR u DiaLLeD iS UnDeRGRouND... PLeaSe TRY uR CaLL NeVeR..."
Reply With Quote