Article View: borland.public.cppbuilder.internet.socket
Article #2009Re: Go from Indy 9 to Indy 8
From: Remy Lebeau (TeamB)
Date: Tue, 05 Sep 2006 18:09
Date: Tue, 05 Sep 2006 18:09
75 lines
3541 bytes
3541 bytes
"Skaarak" <skaarak@NOakamailSPAM.com> wrote in message
news:44fda587$1@newsgroups.borland.com...
> I wish I knew.
Well, you are obviously trying to do something, and something is not working
correctly for you. So what is that something that you are seeing not work
for you?
> As per my post about a month ago:
> Indy 9 TIdFTP EIdConnClosedGracefully etc...
> It is still throwing that disconnect.
As I would have explained to you earlier, that can only occur if the server
is actually closing the connection.
Incidently, did you try upgrading to the latest snapshot yet?
> try {
> if (FTP2->Connected()) {
You do not need to call Connected() if Connect() returns without throwing an
exception.
> try {
> FTP2->ChangeDir("AddOns");
> } catch(const Exception &) {
> return;
> }
You don't need an inner try..catch block around the call to ChangeDir(),
since you already have an outer try..catch that would be able to handle the
same exception.
> delete names;
You are not freeing the TStringList if an exception occurs. That is a
memory leak.
In fact, you do not even need the TStringList at all. Pass the
RemoteDir->Items to ParseDirectory() directly instead.
> try {
> FTP2->List(RawDir->Items,"*", true);
> } catch(const Exception &) {
> return; // Every time w/o fail this Exception is thrown!
> }
The FTP protocol opens a second connection to transfer directory listing
data. The only way you could be getting an EIdConnClosedGracefully
exception in your own code is if the exception is coming from that second
connection and Indy is not catching it properly. Which, again, goes back to
my question of whether you are actually using the latest snapshot version or
not.
> temp = RawDir->Items->Strings[i].SubString(0,10); //directory
//0
AnsiString is 1-based. 0 is an invalid index.
> if (temp.c_str()[0] == 'd' || temp.c_str()[0] == 'D') {
You should be using AnsiString's '[]' operator instead. You also need to
test for an empty string before accessing its characters:
if (!temp.IsEmpty() && ((temp[1] == 'd') || (temp[1] == 'D'))
> Yes, Indy 9.0.50 snapshot w/ 9.0.17 RSP I think.
When exactly did you download the snapshot, though? All of the latest
snapshot releases have been 9.0.50 for awhile now.
Gambit
Technical Details
Message-ID:
<44fdbe50$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.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:
<44f86696$1@newsgroups.borland.com> <44f89ea5$1@newsgroups.borland.com> <44f8ae89$1@newsgroups.borland.com> <44f8b9ba@newsgroups.borland.com> <44fda587$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f4215290349cd894 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: <44f86696$1@newsgroups.borland.com> <44f89ea5$1@newsgroups.borland.com> <44f8ae89$1@newsgroups.borland.com> <44f8b9ba@newsgroups.borland.com> <44fda587$1@newsgroups.borland.com> Subject: Re: Go from Indy 9 to Indy 8 Date: Tue, 5 Sep 2006 11:09:35 -0700 Lines: 77 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: 68.69.17.41 Message-ID: <44fdbe50$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157480016 68.69.17.41 (5 Sep 2006 11:13:36 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.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