Re: Stack Overflow Within the connect method

Giganews Newsgroups
Subject: Re: Stack Overflow Within the connect method
Posted by:  Ron (ron@nospam.simdata.com.au)
Date: Wed, 23 Jun 2004

See my previous post on this issue -  24/5/2004

"Dominic Godin" <nospam@plz> wrote in message
news:Xns95109809F88DFnospamplz@209.120.248.233...
> Hi,
>
> I have a Delphi 5 application that is using Indy 9.0.0.14. This
> application  uses Indy just to upload a couple of text files to an ftp
> server.  This works fine on all but one client machines.
>
> The code is simply:
>
> IdFtpCon.Host := someServer;
> IdFtpCon.Port := somePort;
> IdFtpCon.Username := someUser;
> IdFtpCon.Password := somePassword;
> IdFtpCon.ReadTimeout := someTimeout * 1000;
> idFtpCon.Connect(false);
>
> It falls over on the connect line.  I have dug a bit deeper and it falls
> over in the TIdTCPConnection.GetInternalResponse method.
>
> This is called by the TIdTCPConnection.GetResponse method which is
> called by the TIdFTP.Connect method.
>
> The GetInternalResponse causing the problem has a loop where it is
> adding to a stringlist.  At a guess this loop is not exiting.  Any ideas
> why?
>
> Heres the GetInternalResponse method.
>
> procedure TIdTCPConnection.GetInternalResponse;
> var
>  LLine: string;
>  LResponse: TStringList;
>  LTerm: string;
> begin
>
> LResponse := TStringList.Create; try
>  LLine := ReadLnWait;
>  LResponse.Add(LLine);
>  if Length(LLine) > 3 then begin
>    if LLine[4] = '-' then begin // Multi line response coming
>      LTerm := Copy(LLine, 1, 3) + ' ';
>      {We keep reading lines until we encounter either a line such as
> "250" or "250 Read"}
>        repeat
>          LLine := ReadLnWait;
>          LResponse.Add(LLine);
>        until (Length(LLine) < 4) or (AnsiSameText(Copy(LLine, 1, 4),
> LTerm));
>      end;
>    end;
>  FLastCmdResult.ParseResponse(LResponse);
> finally FreeAndNil(LResponse); end;
>
> end;
>
> Thanks
>
> Dominic Godin

Replies

None

In response to

Stack Overflow Within the connect method posted by Dominic Godin on Tue, 22 Jun 2004