小编Izu*_*uel的帖子

从远程FTP下载文件列表

我在使用TidFTP组件时遇到了问题.

我可以使用这样的代码连接服务器

vFileList := TStringList.Create;
oClientFTP := TidFTP.Create(nil);
oClientFTP.Port := PortFTP;
oClientFTP.Host := IPHost;
oClientFTP.UserName := UserFTP;
oClientFTP.Password := PasswordFTP;
Run Code Online (Sandbox Code Playgroud)

从元素序列中获取多个文件后(这个元素正好有778个元素).检索到137,异常EIdAcceptTimeout以"Accept timed out"引发.信息.

我运行的代码是这样的(顺便说一下在线程中运行)

procedure TDownloadFTP.Get;
begin
try
  for I := 0 to vFileList .Count - 1 do
  begin
    sFileName:= vFileList [I];
    posPoint := LastDelimiter('.', sFileName);
    if posPoint = 0 then
      ForceDirectories(ExtractFilePath(Application.ExeName) + '/BackUp/' + sFileName)
    else
      try
        oClienteFTP.Get(sFileName,IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName) + '/BackUp/') + sFileName, True);
    except

      on E: EIdReplyRFCError do
      begin
      end;
      on E: Exception do
        exceptionList.Add(sFileName);
  end;
end;
Run Code Online (Sandbox Code Playgroud)

异常后,文件正确下载,但每个文件的过程需要25秒(我正在下载2KB的png图像).

知道这个例外的含义吗? …

delphi ftp indy delphi-xe2

3
推荐指数
1
解决办法
2048
查看次数

标签 统计

delphi ×1

delphi-xe2 ×1

ftp ×1

indy ×1