🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9506

Re: how to get the ip address that connects to the internet NOT the local one..

#9506
From: Hans Galema
Date: Tue, 06 Jul 2004 15:56
31 lines
1872 bytes
Oren Halvani wrote:

> i'm try to get the ip-address that connects to the internet:

You mean: the ip-address that someone else needs to connect
to your machine that is on the internet.

> i'm using the following code..
> 
> but it gives me 2 ip-adresses: the local address and the address
> that connects to the internet...
> 
> my question now is how to get ONLY the ip-address that
> connects to the internet..?

As you know how a local ip-address does look like you can remove it
from the list.

But your idea that a machine can determine it's internet-ip
does not hold in most cases. If the machine is behind a router for instance.

The only reliable way is to ask somebody else.

Just click this link.

http://checkip.dyndns.org/

You could parse the resulting page if you got the page from a
HTTP component.

Hans.
Technical Details
Message-ID: <40eacb6e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40eac5cb@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,869e2df9c5cbdd04
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 06 Jul 2004 17:56:50 +0200
From: Hans Galema <dontusethis@dontusethis.nl>
User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: how to get the ip address that connects to the internet NOT the
 local one..
References: <40eac5cb@newsgroups.borland.com>
In-Reply-To: <40eac5cb@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <40eacb6e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089129326 129.125.201.248 (6 Jul 2004 08:55:26 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail