CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Ip Adress

  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Question Ip Adress

    can anytell tell how to get the IP address of a computer using vc++?

  2. #2
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Ip Adress

    [ Moved thread ]

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Ip Adress

    Take a look at the following FAQ...

  4. #4
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    Re: Ip Adress

    you will probably need to store it in a sockaddr_in.... look here

    Code:
           SOCKADDR_IN serverInfo;
           serverInfo.sin_family = AF_INET;
           serverInfo.sin_addr.s_addr = INADDR_ANY;        // Since this socket is listeningfor connections,
                                                           // any local address will do
           serverInfo.sin_port = htons(nPort);          // Convert integer 8888 tonetwork-byte order
    basically, "INADDR_ANY" will give you the ip address.. play around with it to do what you want with it..


    editing: sorry! i misread your post.. i thought you wanted to get the local ip address! but check out section 3.2 (and some of the stuff after that too...) at http://www.tutorialized.com/tutorial...et-Sockets/456
    Last edited by drewdaman; January 20th, 2005 at 05:46 PM.

  5. #5
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Ip Adress

    Can you expand on that? Do you want to use DNS? What?

    ahoodin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured