🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1437

Re: A TCP Server listening to a "real world" address

#1437
From: Remy Lebeau (TeamB)
Date: Tue, 16 Jan 2007 22:06
67 lines
3491 bytes
"Ron Sawyer" <win8128@aol.com> wrote in message
news:45ad2aee$1@newsgroups.borland.com...

> The server is on the machine that is physically connected to the
internet modem.

>     TCPServer->DefaultPort = Port;
>     TIdSocketHandle *LclSocketHandle;
>     LclSocketHandle = TCPServer->Bindings->Add();

Was the server previously active before calling that code?  If so,
then the Bindings collection already had entries in it.  Setting the
DefaultPort has no effect on existing entries.  Make sure the
collection is empty before setting it up with new values.

>     LclSocketHandle->IP = JvIPAddress1->Text;

Setting the IP property locks down the Binding to a specific local IP.
If you leave the IP empty, then the Binding will listen on all
available local IPs.

> JVIPAddress is simply an edit that the JEDI project provides for
> internet addresses.

Is it reporting the correct IP for the modem, though?

> This may be the part I'm not doing correctly - it seems possible
> that I do not know how to obtain my public IP address.

You have to specify the local IP that the server is going to physical
listen on.  If the modem is directly connected to the machine, then
the local IP for that adapter is the same as the modem's public IP.
The GStack.LocalAddresses list will contain that IP.  The IPs in that
list are the only IPs that you can tell the server to listen on.

> There server is certainly listening.

How are you verifying that exactly?

> As mentioned, I run the client on the same machine and it works
perfectly.

Which IP is the client actually connecting to locally?  Since you are
specifying the IP for the Binding collection, you are likely not
adding an entry for the local loopback IP (127.0.0.1).  So I am
assuming that you are specifying the modem's IP when connecting
locally?

> Only when I have the client run from a machine at work does it fail.

Like I said earlier, the client at work is likely specifying the wrong
IP/Port.  Or worse, your work's LAN is probably blocking the
connection.  Many company LANs have firewalls in place to limit what
employees can access.  Did you verify with the network admin that your
client is even allowed to reach your server?

> The machine at work can ping me, so it *seems* to me that the
address
> I provide is my public address.

Not necessarily.  A ping only tells you whether the machine is
physically reachable.  That does not guarantee that a connection to a
specific server runing on that machine will succeed.


Gambit
Technical Details
Message-ID: <45ad4c2d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45acd81e$1@newsgroups.borland.com> <45ad13c8$1@newsgroups.borland.com> <45ad2aee$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,243788a951e89736
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45acd81e$1@newsgroups.borland.com> <45ad13c8$1@newsgroups.borland.com> <45ad2aee$1@newsgroups.borland.com>
Subject: Re: A TCP Server listening to a "real world" address
Date: Tue, 16 Jan 2007 14:06:01 -0800
Lines: 69
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.83.34.171
Message-ID: <45ad4c2d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1168985133 75.83.34.171 (16 Jan 2007 14:05:33 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail