delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/07/09:43:24

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: RE: Finding Out My Own IP-Address
7 May 1998 09:43:24 -0700 :
Message-ID: <01BD79C2.583AD970.cygnus.gnu-win32@drs>
To: "gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>,
"'Oliver Copp'"
<lyger AT fh-landshut DOT de>

Oliver Copp wrote:
> 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. 
> 

Try gethostbyname(gethostname()).

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019