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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. dotted ip address to name?

dotted ip address to name?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminalgorithmsjsonhelpquestion
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.
  • M Offline
    M Offline
    montiee
    wrote on last edited by
    #1

    I'm currently coding a server and accepting incoming connections using the CAsyncSocket class under Vista. Things are working fine but now I would like to be able to resolve the dotted IP address CAsyncSocket::GetPeerName() returns into a nice human readable name so users can easily identify connections rather than remembering strings of numbers (dotted ip's). Can someone point me to the API which will help me do that. Spent a while searching but everything talks about going the other way, that is name->dotted ip, not dotted ip->name. Thanks!

    D 1 Reply Last reply
    0
    • M montiee

      I'm currently coding a server and accepting incoming connections using the CAsyncSocket class under Vista. Things are working fine but now I would like to be able to resolve the dotted IP address CAsyncSocket::GetPeerName() returns into a nice human readable name so users can easily identify connections rather than remembering strings of numbers (dotted ip's). Can someone point me to the API which will help me do that. Spent a while searching but everything talks about going the other way, that is name->dotted ip, not dotted ip->name. Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      jbem wrote:

      ...I would like to be able to resolve the dotted IP address CAsyncSocket::GetPeerName() returns into a nice human readable name...

      Which of the two GetPeerName() methods are you using? Have you tried gethostbyaddr()?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      M 1 Reply Last reply
      0
      • D David Crow

        jbem wrote:

        ...I would like to be able to resolve the dotted IP address CAsyncSocket::GetPeerName() returns into a nice human readable name...

        Which of the two GetPeerName() methods are you using? Have you tried gethostbyaddr()?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        M Offline
        M Offline
        montiee
        wrote on last edited by
        #3

        Thanks I missed the gethostbyaddr(). I used getnameinfo() since gethostbyaddr is deprecated and it worked out fine. Thanks for your help!

        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