Thread: Show IP Address

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    61

    Show IP Address

    How can i make an application that show my extern IP address?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    What OS?
    Do you want show the IP for all interfaces on the system?

    gg

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    61
    Windows, i just want to write a console appliction that outputs my extern IP

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Code:
    #include <cstdlib>
    
    int main()
    {
        system( "ipconfig" );
        return 0;
    }
    or you can save some time and just run IPCONFIG from a command line.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    61
    Quote Originally Posted by cpjust View Post
    Code:
    #include <cstdlib>
    
    int main()
    {
        system( "ipconfig" );
        return 0;
    }
    or you can save some time and just run IPCONFIG from a command line.
    It only has to output your extern IP, so i can check if it 0.0.0.0 fo example

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Do you just want to check if you have an internet connection?

    What's the end goal?

    gg

  7. #7
    Registered User
    Join Date
    Jul 2007
    Posts
    61
    Quote Originally Posted by Codeplug View Post
    Do you just want to check if you have an internet connection?

    What's the end goal?

    gg
    I only want specific IP address to be able to use my program. so i have to check if the IP is for example 0.0.0.0

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Here's one of a few ways to enumerate your interfaces:

    http://support.microsoft.com/kb/186312/en-us

    gg

  9. #9
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by brietje698 View Post
    How can i make an application that show my extern IP address?
    Go to http://www.ipchicken.com

    That shows your REAL "external" IP address, as far as the rest of the Internet is concerned.

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by brewbuck View Post
    Go to http://www.ipchicken.com

    That shows your REAL "external" IP address, as far as the rest of the Internet is concerned.
    But that's not the IP address of MY computer, but of the other side of the set of router/firewall/proxy server stuff that ends up issuing the EXTERNAL IP-address. I can have two dozen machines this side of the network equipment, all with their completely separate IP addresses.

    Also note that relying on IP address to stay static won't work if you use a DHCP server - then the address is likely to change every now and again - particularly if the machine is shut down and rebooted a day or two later, it's VERY likely to have a differnet IP-address.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I thought pointers were pointers...
    By keira in forum C Programming
    Replies: 19
    Last Post: 08-15-2007, 11:48 PM
  2. use of ip address
    By munna_dude in forum Networking/Device Communication
    Replies: 1
    Last Post: 05-23-2007, 04:54 AM
  3. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  4. Obtain local machine IP address
    By magic.mike in forum Windows Programming
    Replies: 4
    Last Post: 03-18-2005, 10:40 AM
  5. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM