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. Computer name

Computer name

Scheduled Pinned Locked Moved C#
sysadmin
9 Posts 5 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.
  • P Offline
    P Offline
    peropata
    wrote on last edited by
    #1

    Hi, Is it possible to get computer name from "IP_adress" in local network.

    P A 2 Replies Last reply
    0
    • P peropata

      Hi, Is it possible to get computer name from "IP_adress" in local network.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Use Dns.GetHostEntry to retrieve an IPHostEntry, and get the HostName from this.

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      1 Reply Last reply
      0
      • P peropata

        Hi, Is it possible to get computer name from "IP_adress" in local network.

        A Offline
        A Offline
        Ankur m
        wrote on last edited by
        #3

        Try System.Environment.MachineName

        ..Go Green..

        R 1 Reply Last reply
        0
        • A Ankur m

          Try System.Environment.MachineName

          ..Go Green..

          R Offline
          R Offline
          RaviRanjanKr
          wrote on last edited by
          #4

          Ankurm/ wrote:

          System.Environment.MachineName

          Simple way of getting MachineName you should focus on question which is about get Computer Name based on Ip Address and Pete O'Hanlon answered better and noting can be better than. :omg:

          A 1 Reply Last reply
          0
          • R RaviRanjanKr

            Ankurm/ wrote:

            System.Environment.MachineName

            Simple way of getting MachineName you should focus on question which is about get Computer Name based on Ip Address and Pete O'Hanlon answered better and noting can be better than. :omg:

            A Offline
            A Offline
            Ankur m
            wrote on last edited by
            #5

            Code to get IP address and then host name from that IP Address rather than getting the host name directly doesn't make much sense to me. I don't know why I feel that the user wants to ask if he can get the computer name from IP address available to him, which is not possible until he has an "IP Address - Host Name" mapping records available with him. I may be wrong though.

            ..Go Green..

            F 1 Reply Last reply
            0
            • A Ankur m

              Code to get IP address and then host name from that IP Address rather than getting the host name directly doesn't make much sense to me. I don't know why I feel that the user wants to ask if he can get the computer name from IP address available to him, which is not possible until he has an "IP Address - Host Name" mapping records available with him. I may be wrong though.

              ..Go Green..

              F Offline
              F Offline
              fjdiewornncalwe
              wrote on last edited by
              #6

              If the question doesn't make sense to you, don't provide an answer. The question that was asked was clear, concise and specific. I wish all questions were like this one. Your comment above is valid, however, and I agree with you somewhat, but perhaps he is doing some log file post resolution of the host name and the log file only holds IPs.(for example only). You should have provided this information with your initial answer and people probably wouldn't have voted you down.

              I wasn't, now I am, then I won't be anymore.

              A 1 Reply Last reply
              0
              • F fjdiewornncalwe

                If the question doesn't make sense to you, don't provide an answer. The question that was asked was clear, concise and specific. I wish all questions were like this one. Your comment above is valid, however, and I agree with you somewhat, but perhaps he is doing some log file post resolution of the host name and the log file only holds IPs.(for example only). You should have provided this information with your initial answer and people probably wouldn't have voted you down.

                I wasn't, now I am, then I won't be anymore.

                A Offline
                A Offline
                Ankur m
                wrote on last edited by
                #7

                PogoboyKramer wrote:

                If the question doesn't make sense to you, don't provide an answer.

                Read the comments again. I never said the question doesn't make sense to me. I was rather supporting my answer with the comment.

                PogoboyKramer wrote:

                but perhaps he is doing some log file post resolution of the host name and the log file only holds IPs.(for example only).

                You mean you have a log file which contains IP address only and you want to get the host name from IP addresses. How do you think that would be possible. Again, my previous comment answers this question.

                PogoboyKramer wrote:

                You should have provided this information with your initial answer and people probably wouldn't have voted you down.

                I do agree to this and am sorry about it.

                ..Go Green..

                F 1 Reply Last reply
                0
                • A Ankur m

                  PogoboyKramer wrote:

                  If the question doesn't make sense to you, don't provide an answer.

                  Read the comments again. I never said the question doesn't make sense to me. I was rather supporting my answer with the comment.

                  PogoboyKramer wrote:

                  but perhaps he is doing some log file post resolution of the host name and the log file only holds IPs.(for example only).

                  You mean you have a log file which contains IP address only and you want to get the host name from IP addresses. How do you think that would be possible. Again, my previous comment answers this question.

                  PogoboyKramer wrote:

                  You should have provided this information with your initial answer and people probably wouldn't have voted you down.

                  I do agree to this and am sorry about it.

                  ..Go Green..

                  F Offline
                  F Offline
                  fjdiewornncalwe
                  wrote on last edited by
                  #8

                  Thanks for the response. (I didn't mean to sound priskish, BTW) The IP resolution from log file is something I did a couple years back, but for the life of me, I can't remember how. Maybe I'm just blocking out the bad memories. Have a five for this one.

                  I wasn't, now I am, then I won't be anymore.

                  A 1 Reply Last reply
                  0
                  • F fjdiewornncalwe

                    Thanks for the response. (I didn't mean to sound priskish, BTW) The IP resolution from log file is something I did a couple years back, but for the life of me, I can't remember how. Maybe I'm just blocking out the bad memories. Have a five for this one.

                    I wasn't, now I am, then I won't be anymore.

                    A Offline
                    A Offline
                    Ankur m
                    wrote on last edited by
                    #9

                    Thanks! :-D Cheers! Ankur

                    ..Go Green..

                    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