Article View: borland.public.cppbuilder.internet.socket
Article #1436Re: A TCP Server listening to a "real world" address
From: Ron Sawyer
Date: Tue, 16 Jan 2007 19:43
Date: Tue, 16 Jan 2007 19:43
42 lines
3141 bytes
3141 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
Remy, I was hoping you would answer - I figured you would know.
>Then the client is likely trying to connect to the server using the
>wrong IP/Port. Is the server running on the machine that is
>physically connected to the Internet modem? Or is the server running
>on a machine that is getting its Internet connection through a
>router/proxy? What does your TIdTCPServer setup look like? How are
>you configuring its Bindings collection exactly?
>
The server is on the machine that is physically connected to the internet modem. The code to connect is:
int Port;
Port = Edit1->Text.ToInt();
TCPServer->DefaultPort = Port;
TIdSocketHandle *LclSocketHandle;
LclSocketHandle = TCPServer->Bindings->Add();
LclSocketHandle->IP = JvIPAddress1->Text;
TCPServer->Active = true;
JVIPAddress is simply an edit that the JEDI project provides for internet addresses. The rest is Indy stuff.
>> The address I use is obtained via the ipconfig command.
>
>Indy has its own global GStack.LocalAddresses list that contains the
>available IP adresses of the machine. If the server machine is
>physicaly connected to the modem, then are you specifying the modem's
>public IP as the listening IP on the server?
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. I am going to a DOS prompt, typing IPCONFIG and using the address that comes back. You mention that Indy has a global stack of address. I will start looking at that some and see if I can figure out how to obtain the address I want.
>
>> However, the client cannot contact the server from that same
>machine.
>
>Yes, it can. Especially if it is on the same machine. If it is not
>connecting, then either the server is not actually listening in the
>first place, or the client is connecting to the wrong IP/Port.
There server is certainly listening. As mentioned, I run the client on the same machine and it works perfectly. Only when I have the client run from a machine at work does it fail. The machine at work can ping me, so it *seems* to me that the address I provide is my public address.
Technical Details
Message-ID:
<45ad2aee$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45acd81e$1@newsgroups.borland.com> <45ad13c8$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: "Ron Sawyer" <win8128@aol.com> Sender: "Ron Sawyer" <win8128@aol.com> Reply-To: "Ron Sawyer" <win8128@aol.com> Subject: Re: A TCP Server listening to a "real world" address Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 20.137.18.52 References: <45acd81e$1@newsgroups.borland.com> <45ad13c8$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <45ad2aee$1@newsgroups.borland.com> Date: 16 Jan 2007 11:43:42 -0800 X-Trace: newsgroups.borland.com 1168976622 207.105.83.66 (16 Jan 2007 11:43:42 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail