Subject: Re: Finding Out My Own IP-Address
From: [email-masked] (Nicholas R LeRoy)

8 May 1998 01:29:29 -0700
Message-ID: <9805070846.ZM18698.cygnus.gnu-win32@dopey>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: Oliver Copp <[email-masked]>, [email-masked]

On May 6, 10:55pm, Oliver Copp wrote:
> Subject: Finding Out My Own IP-Address
> Hi !
>
> Is there a function which allows me to find out my current IP address ?
>
> My best guess was to use gethostbyname("localhost") but that always returns
> 127.0.0.1.
>
> When I dial in to my provider via NT-RAS, I'm assigned a dynamic IP address -
> which is what I'm trying to find out.

It's been a while since I've done socket programming, but if I remember
correctly, what you want to do is use "gethostname" to get youre host's
real name, and then "gethostbyname" to look up the IP.  Note that if you
have more than one interface, it becomes more complicated.  Probably irrelevant
in the WinDoze world, though.

-Nick

-- 
+-------------------------------+--------------------------------------------+
| /`--_   Nicholas R LeRoy      | In a world without fences, Who needs Gates?|
|{     }/ Norland Corporation   |        ---- Experience Linux! ----         |
| \ *  / W6340 Hackbarth Rd     | http://www.linux.org | http://www.ssc.com  |
| |___| Fort Atkinson, WI 53538 +--------------------------------------------+
|      [email-masked]   | #include <disclaimer.h>                    |
|http://www.norland.com/~nleroy | These are my own ideas, not my employer's. |
+----------------------------------------------------------------------------+
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".