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. How to resolve the remote host name from IP address? [modified]

How to resolve the remote host name from IP address? [modified]

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 3 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.
  • H Offline
    H Offline
    Hussam Fattahi
    wrote on last edited by
    #1

    The function Socket.AcceptSocket() creates a new socket for a connection, I can get the remote host IP address from Socket.RemoteEndPoint. but I want to know the remote host name(computer name), can i resolve the name from an IP address? -- modified at 11:45 Tuesday 13th February, 2007

    T W 2 Replies Last reply
    0
    • H Hussam Fattahi

      The function Socket.AcceptSocket() creates a new socket for a connection, I can get the remote host IP address from Socket.RemoteEndPoint. but I want to know the remote host name(computer name), can i resolve the name from an IP address? -- modified at 11:45 Tuesday 13th February, 2007

      T Offline
      T Offline
      topcatalpha
      wrote on last edited by
      #2

      Hi, i didn't test this but found it by searching for the local PC name. System.Net.Dns.BeginResolve or System.Net.Dns.Resolve if you also write the server app. you can send it yourself by using this at server site. System.Windows.Forms.SystemInformation.ComputerName; or System.Net.Dns.GetHostName(); hope it helps. :) Greetz Kurt Okay i did a small test for you .. and seems to work (but depreceated). System.Net.IPHostEntry tmp = System.Net.Dns.Resolve(textBox1.Text); textBox2.Text = tmp.HostName; fill in IP address in textbox1.. greetz -- modified at 10:57 Tuesday 13th February, 2007

      1 Reply Last reply
      0
      • H Hussam Fattahi

        The function Socket.AcceptSocket() creates a new socket for a connection, I can get the remote host IP address from Socket.RemoteEndPoint. but I want to know the remote host name(computer name), can i resolve the name from an IP address? -- modified at 11:45 Tuesday 13th February, 2007

        W Offline
        W Offline
        wasife
        wrote on last edited by
        #3

        I think you should use System.Net.Dns.GetHostByAddress(String address) Regards, Wasif Ehsan.

        T 1 Reply Last reply
        0
        • W wasife

          I think you should use System.Net.Dns.GetHostByAddress(String address) Regards, Wasif Ehsan.

          T Offline
          T Offline
          topcatalpha
          wrote on last edited by
          #4

          Yep. Also seems to work. VS2005 suggests System.Net.Dns.GetHostEntry() when compiling. so there are several ways... ;) greetz Kurt

          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