🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TClientSocket::LocalAddress

#2020
From: Remy Lebeau (TeamB)
Date: Thu, 10 May 2007 18:04
35 lines
2131 bytes
"Robert G. Hoover" <not.a.real.address@anywhere.sorry> wrote in
message news:46434854$1@newsgroups.borland.com...

> I'm identifying myself to the server as Socket->LocalHost
>
> ehlo [192.168.0.109]
>
> which seems to work on my laptop where LocalAddress = 192.168.0.109
> and does not work on my desktop where LocalAddress = 127.0.0.1.

The LocalAddress can only be 127.0.0.1 if you had connected to
"localhost" when connecting the socket.  Is your server running on the
same desktop machine as your client program?

> Neither of these is ideal as I think the SMTP server wants my
> "worldview" IP address which is something like 109.76.35.22.

Actually, you should be sending your machine name, not your IP
address.

> How can I determine my actual IP address from inside this
TClientSocket object?

If you are directly connected to the Internet, such that your modem is
physically plugged into your machine, then you can use
GetAdaptersInfo() to get the IP address from the desired NIC, which
should be the same IP that LocalAddress returns.  But if you are
getting your Internet access through a router or gateway, then you
will have to query an external source, such as
http://iplookup.flashfxp.com or similar site, to get your public IP
address.


Gambit
Technical Details
Message-ID: <46435e8d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46434854$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a04762d1675e9ed3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <46434854$1@newsgroups.borland.com>
Subject: Re: TClientSocket::LocalAddress
Date: Thu, 10 May 2007 11:04:18 -0700
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.82.60.244
Message-ID: <46435e8d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1178820237 75.82.60.244 (10 May 2007 11:03:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail