Re: FTP Get resume -Additional Info

Giganews Newsgroups
Subject: Re: FTP Get resume -Additional Info
Posted by:  Bill Thomasson (bthomass…@custard.com)
Date: Wed, 26 Jul 2006

I looked at Indy 9, and TIdFTP.Get was:
procedure TIdFTP.Get(const ASourceFile: string; ADest: TIdStream; AResume: Boolean = False);
begin
  //for SSL FXP, we have to do it here because InternalGet is used by the LIST command
  //where SSCN is ignored.
  AResume := AResume and CanResume;
  InternalGet('RETR ' + ASourceFile, ADest, AResume);
end;

Bill

> I am having trouble with resuming gets
>
> I have the line:
>
>  IdFTP.Get(sRemoteFileName, sLocalFile,False,True);
>
> But watching the file transfer, if it the connection was broken previously,
> it starts again at
> 0 bytes.
>
> Looking into the idFTP.pas, the Get Creates the append stream, and then call
> s Get with the
> stream.
>
> procedure TIdFTP.Get(const ASourceFile: string; ADest: TIdStream; AResume: B
> oolean = False);
> begin
>  //for SSL FXP, we have to do it here because InternalGet is used by the LI
> ST command
>  //where SSCN is ignored.
>  ClearSSCN;
>  AResume := AResume and CanResume;
>  ADest.Position := 0; <-------------- Starts from begining. Bill
>  InternalGet('RETR ' + ASourceFile, ADest, AResume);
> end;
>
> It then sets the destination to the begining of the stream, overwriting what
>  was there.
> If I comment out ADest.Position := 0; then it picks up where it left off.
>
> Is this a bug?  Is there some other reason that in a resume it should be set
> ting the position to 0?
>
> Possibly it should be
>
> if Not AResume Then
>  ADest.Position := 0;
>
> Thanks for any input, just don't want to change Indy code without confirmati
> on.  In all my testing
> it seams to fix the problem and allow resumes to work.
>
> Bill Thomasson

Replies

None

In response to

FTP Get resume posted by Bill Thomasson on Wed, 26 Jul 2006