About getting IP Address of all Computers which are connected in LAN with my Computer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vabh
    New Member
    • Feb 2008
    • 9

    About getting IP Address of all Computers which are connected in LAN with my Computer

    Help from there, i want the IP Address of all computers which are connected in LAN with me. Its really urgent for me. I using one kind of coding which returns me IP Address of only one computer, but when i enter a Computer Name. The source code of that one is as follows:

    *************** *************** *************** *************** *************** *************** **
    Code:
     Dim s1, s2 As String 
    Dim IPHost As IPHostEntry = Dns.GetHostEntry("Modelling")
    s1 = IPHost.HostName.ToString
    Dim aliases() As String
    aliases = IPHost.Aliases
    Dim addr() As IPAddress
    addr = IPHost.AddressList
    s2 = addr(0).ToString
    lblnm.Text = s1 & s2
    Dim ep As EndPoint = New IPEndPoint(addr(0), 80)
    Dim sock As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    sock.Connect(ep)
    lblname.Text = s1 & s2 & "Not Connected"
    sock.Shutdown(SocketShutdown.Both)
    So I am requesting to you please help me as early as possible....
    Last edited by DrBunchman; May 16 '08, 08:04 AM. Reason: Added code tags and moved to .NET forum
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Unless you have a master computer(possib ly your dhcp server) that you can talk to, it's not going to be a fast task.
    Pretty sure you will need to ping every address and see if there's a response. Which also doesn't garuntee anything since some computers are setup to not respond to ping requests.

    Comment

    Working...