Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help: Getting the IPAddresses of Computers in a Workgroup

Help: Getting the IPAddresses of Computers in a Workgroup

Scheduled Pinned Locked Moved Visual Basic
csharphelpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lordkaile
    wrote on last edited by
    #1

    Help please.. Can anyone there resolve this? -Sample Code- System.Net ... 'let's assume there are other codes here dim Addr as IPAddress With DNS.GetHostByName() Addr = System.Net.IPAddress(.AddressList(0).Address) End With ... That should have been the way to get the IP Addresses, but in VBNET 2003 the line: "(.AddressList(0).Address)" is obsolete.. Anyone knows the new way?? Be grateful for the help.. Thanks in advance..

    D 1 Reply Last reply
    0
    • L lordkaile

      Help please.. Can anyone there resolve this? -Sample Code- System.Net ... 'let's assume there are other codes here dim Addr as IPAddress With DNS.GetHostByName() Addr = System.Net.IPAddress(.AddressList(0).Address) End With ... That should have been the way to get the IP Addresses, but in VBNET 2003 the line: "(.AddressList(0).Address)" is obsolete.. Anyone knows the new way?? Be grateful for the help.. Thanks in advance..

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Since you got that "obsolete" message, you're using VB.NET 2005. Check out the Dns class and its GetHostAddesses[^] method.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      L 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Since you got that "obsolete" message, you're using VB.NET 2005. Check out the Dns class and its GetHostAddesses[^] method.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        L Offline
        L Offline
        lordkaile
        wrote on last edited by
        #3

        Hmm.. but i'm using Visual Studio 2003.. anyways do u know another way? Hope u can help me.. i'm still lookin for another way though.. Thanks

        D 1 Reply Last reply
        0
        • L lordkaile

          Hmm.. but i'm using Visual Studio 2003.. anyways do u know another way? Hope u can help me.. i'm still lookin for another way though.. Thanks

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          There's only two methods. The one you posted in your code, which gave you the obsolete message, and the one in the .NET Framework 2.0. The .NET Framework 1.0 and 1.1 both use the same Dns class. It was nearly completely re-written for .NET 2.0. This[^] is the docs for the 1.0/1.1 version of the Dns class.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          L 1 Reply Last reply
          0
          • D Dave Kreskowiak

            There's only two methods. The one you posted in your code, which gave you the obsolete message, and the one in the .NET Framework 2.0. The .NET Framework 1.0 and 1.1 both use the same Dns class. It was nearly completely re-written for .NET 2.0. This[^] is the docs for the 1.0/1.1 version of the Dns class.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            L Offline
            L Offline
            lordkaile
            wrote on last edited by
            #5

            " 'Public Property Address() AS Long' is obsolete: 'IPAddress.Address is address family dependant, use equals method for comparison.' " That's the whole statement of the error. My framework is 1.1, and it cant be 2.0 coz im not using VS2005.. but can i use Framework 2.0 with VS2003? i haven't found another way..and how can i set the client to look for any server running in any of the pc in a network. Like if i run a Server or the listener on PC4, the client is on PC1, without specifying the IPAddress where the Server file is running.. if i transfer the server to PC8, the client can still detect it. Something like that. I'm actually new on using System.Net and im just lookin on examples available in the web. I have tried the basics of Server-Client, the problem is the one i stated above. and the client issue.. thanks

            D 1 Reply Last reply
            0
            • L lordkaile

              " 'Public Property Address() AS Long' is obsolete: 'IPAddress.Address is address family dependant, use equals method for comparison.' " That's the whole statement of the error. My framework is 1.1, and it cant be 2.0 coz im not using VS2005.. but can i use Framework 2.0 with VS2003? i haven't found another way..and how can i set the client to look for any server running in any of the pc in a network. Like if i run a Server or the listener on PC4, the client is on PC1, without specifying the IPAddress where the Server file is running.. if i transfer the server to PC8, the client can still detect it. Something like that. I'm actually new on using System.Net and im just lookin on examples available in the web. I have tried the basics of Server-Client, the problem is the one i stated above. and the client issue.. thanks

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              OK. So you're using 2003. No, you can't use .NET 2.0 with VS.NET 2003. It will only work with VS.NET 2005. Remove the .Address part of the line. You don't need it unless you want the IP address returned as a 32-bit number. This isn't supported in .NET 2.0, so don't use it. This code works just fine:

              Dim hostInfo As IPHostEntry = Dns.GetHostByName("www.yahoo.com")
              Dim address As IPAddress() = hostInfo.AddressList
              

              Dim al As String() = hostInfo.Aliases
              Debug.WriteLine("Host name : " + hostInfo.HostName)
              Debug.WriteLine(ControlChars.Cr + "Aliases : ")
               
              Dim index As Integer
              For index = 0 To al.Length - 1
              Debug.WriteLine(al(index))
              Next index
               
              Debug.WriteLine(ControlChars.Cr + "IP address list : ")
              For index = 0 To address.Length - 1
              Debug.WriteLine(address(index))
              Next index

              and was taken directly out of the docs for Dns.GetHostByName in the .NET 1.0/1.1 docs.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups