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 / C++ / MFC
  4. How can I get the IP automatically?

How can I get the IP automatically?

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadminlounge
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
    Mension
    wrote on last edited by
    #1

    I am trying to do a chat room. How can I get the IP on which PC my server program is running automatically? Which method should I use?

    O 1 Reply Last reply
    0
    • M Mension

      I am trying to do a chat room. How can I get the IP on which PC my server program is running automatically? Which method should I use?

      O Offline
      O Offline
      only coding
      wrote on last edited by
      #2

      struct hostent* phostent; char name[128]; gethostname( name, 128 ); phostent = gethostbyname( name ); if( phostent ) { CString strIP = inet_ntoa( *(in_addr*)phostent->h_addr_list[0] ); }

      Are you have gtalk ? please add me: xiangyangzhao@gmail.com

      M 1 Reply Last reply
      0
      • O only coding

        struct hostent* phostent; char name[128]; gethostname( name, 128 ); phostent = gethostbyname( name ); if( phostent ) { CString strIP = inet_ntoa( *(in_addr*)phostent->h_addr_list[0] ); }

        Are you have gtalk ? please add me: xiangyangzhao@gmail.com

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

        Thank you for you answer firstly.I will try it. Sorry that I don't use GTalk, but I use the GTalk ToolKit to joined you. You can send me a mail:caiminsheng@gmail.com or join my QQ:113931427 if you would like to.

        modified on Monday, December 24, 2007 5:36:46 AM

        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