Sorry, I had not understood what you was saying.
 I found a better way to fix the issue: Use soBeginning instead of 
soFromBeginning when calling Seek !
 This way, the compiler pick the correct overloaded Seek version.
  
 The correct line is now:
     FFilestream.Seek(HttpCli.FStartOffset + HttpCli.FDataCount,
                     soBeginning); 
  
 Please try and tell me if is works for you.
  
  
 And please, for your next issue, even to report bugs, use the support mailing 
list instead of email sent directly to me. See "support" link at my website for 
details. It is free of charge.
  
  
  
  
  
  
 =====================================
  
 ok,use soBeginning work fine!
  
 continue next question
  
 demo project OverbyteIcsFtpMultipartDownload
  
 if the file size is 100KB on server
 i use OverbyteIcsFtpMultipartDownload download it back,may be it's size 110KB
  
 i do this:
 procedure TMultipartFtpDownloader.DownloadDocData(
    Sender : TObject;
    Data   : Pointer;
    Len    : Integer);
var
    FtpCli : TMyFtpCli;
begin
    TimeoutTimer.Enabled  := FALSE;
    TimeoutTimer.Enabled  := TRUE; //the two line fix timeout ,default is 30 
seconds, and not disable in the data trans time
    if Len <= 0 then
        Exit;
    if FPauseFlag then
        Exit;
    FtpCli            := Sender as TMyFtpCli;
    if Len> ((FtpCli.FEndOffset - FtpCli.FStartOffset)-FtpCli.FDataCount+1)  
then begin
       Len:=(FtpCli.FEndOffset - FtpCli.FStartOffset)-FtpCli.FDataCount+1;
    end;
    if Len>0 then begin
      FFileStream.Seek(FtpCli.FStartOffset + FtpCli.FDataCount,
                        soBeginning);
      FFileStream.WriteBuffer(Data^, Len);
       FtpCli.FDataCount := FtpCli.FDataCount + Len;
      FTotalCount        := FTotalCount + Len;
      TriggerProgressSetPosition(FtpCli.FIndex,
                                 FtpCli.FStartOffset + FtpCli.FDataCount);
    end;
    // Todo: Check if that component has finished his range and abort the
    // transfer when finished.
    if FtpCli.FDataCount >= (FtpCli.FEndOffset - FtpCli.FStartOffset) then begin
        // Component has finished his part
        Display(Format('%03.3d %s',
                       [FtpCli.FIndex + 1, 'Part done DownloadDocData']));
        PostMessage(Handle, FMsg_WM_PART_DONE, 0, LParam(FtpCli));
    end;
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to