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. IP ADRESS

IP ADRESS

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 4 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.
  • A Offline
    A Offline
    ashish dogra
    wrote on last edited by
    #1

    how to get syetem ip addres in an dialog box i use ipadress control for that but can somebody tell me wat code i write on a button to get ip address of the sytem Ashish Dogra MCA Noida

    A A H 3 Replies Last reply
    0
    • A ashish dogra

      how to get syetem ip addres in an dialog box i use ipadress control for that but can somebody tell me wat code i write on a button to get ip address of the sytem Ashish Dogra MCA Noida

      A Offline
      A Offline
      Abhi Lahare
      wrote on last edited by
      #2

      gethostname() for getting name of system and then call gethostbyname() See MSDN for more help on these function Regards Abhishake Lahare

      A 1 Reply Last reply
      0
      • A ashish dogra

        how to get syetem ip addres in an dialog box i use ipadress control for that but can somebody tell me wat code i write on a button to get ip address of the sytem Ashish Dogra MCA Noida

        A Offline
        A Offline
        A_Fa
        wrote on last edited by
        #3

        Hi jigar . void GetIPAddress(char *ipAddress) { #define MAX_NAME_LEN 65 WSADATA wsaData; if ( WSAStartup( MAKEWORD( 2, 2 ), &wsaData ) == 0 ) { char HostName[MAX_NAME_LEN]; struct in_addr *ptr; gethostname (HostName,MAX_NAME_LEN); hostent *host = gethostbyname(HostName); if(host == NULL) { ipAddress = NULL ; WSACleanup( ); return ; } ptr = (struct in_addr *)host->h_addr_list[0]; CString str; str.Format("%d.%d.%d.%d", ptr->S_un.S_un_b.s_b1, ptr->S_un.S_un_b.s_b2, ptr->S_un.S_un_b.s_b3, ptr->S_un.S_un_b.s_b4); strcpy(ipAddress,(char*)str.GetString()); } WSACleanup( ); }

        1 Reply Last reply
        0
        • A Abhi Lahare

          gethostname() for getting name of system and then call gethostbyname() See MSDN for more help on these function Regards Abhishake Lahare

          A Offline
          A Offline
          ashish dogra
          wrote on last edited by
          #4

          thanks but can you tell me what are parameters in the gethostname() as a code to help me Ashish Dogra MCA Noida

          1 Reply Last reply
          0
          • A ashish dogra

            how to get syetem ip addres in an dialog box i use ipadress control for that but can somebody tell me wat code i write on a button to get ip address of the sytem Ashish Dogra MCA Noida

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            See Here[^]_**


            **_

            whitesky


            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