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. C#
  4. Validating IP Addresses

Validating IP Addresses

Scheduled Pinned Locked Moved C#
comsysadmintoolshelpquestion
3 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.
  • J Offline
    J Offline
    Jammer 0
    wrote on last edited by
    #1

    Hi All, I'm just working with the Dns class and have a need to use IP addresses. At the moment I'm just retrieving a list of IP addresses using the GetHostByName method and then validing the format of each IP address. The issue is that I'm then going to use this as a base for producing some service endpoints. I want to make sure that the IP address I use is correct for the machines identity on our network rather than just grabbing the first IP address in the list which seems a bit random. Should I be calling a domain controller and confirming with it that the IP address I plan to use is the 'correct' one? Cheers,

    Jammer My Blog | Article(s)

    Q 1 Reply Last reply
    0
    • J Jammer 0

      Hi All, I'm just working with the Dns class and have a need to use IP addresses. At the moment I'm just retrieving a list of IP addresses using the GetHostByName method and then validing the format of each IP address. The issue is that I'm then going to use this as a base for producing some service endpoints. I want to make sure that the IP address I use is correct for the machines identity on our network rather than just grabbing the first IP address in the list which seems a bit random. Should I be calling a domain controller and confirming with it that the IP address I plan to use is the 'correct' one? Cheers,

      Jammer My Blog | Article(s)

      Q Offline
      Q Offline
      quacks_a_lot
      wrote on last edited by
      #2

      I'd imagine if the Dns class returned the IP address for the hostname you were looking for (or the other way around), then that would be the correct IP address. If it is the wrong IP address, the host you are looking for either changed names or is offline.

      J 1 Reply Last reply
      0
      • Q quacks_a_lot

        I'd imagine if the Dns class returned the IP address for the hostname you were looking for (or the other way around), then that would be the correct IP address. If it is the wrong IP address, the host you are looking for either changed names or is offline.

        J Offline
        J Offline
        Jammer 0
        wrote on last edited by
        #3

        Hi, Actually I'm using IPEntry on the machine I want to get the network IP for. When using IPEntry you get back IPAddress[] so currently I'm just taking the entry at position 0 which to me seems a bit prone to errors to rely on there being the actual machine network IP address at position 0. Cheers,

        Jammer My Blog | Article(s)

        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