在delphi6下使用IdFTP控件向ftpServer上传文件,中途调用IdFTP1.Abort;目的是中止文件上传且保持链接````但是实际程序会抛出异常‘connect gracefully’并且连接断开。
我用delphi提供的demo试了一下也有同样的情况,请问各位高手如何解决这问题?

解决方案 »

  1.   

    Try
        if b_TransFile Then //变量b_TransFile初始化为false,开始上传为true,传完为false
           IdFtp1.Abort;
        IdFtp1.Quit;
    except
    end;
      

  2.   

    根据IndyFAQ中所说的,这个不是Indy的bug,而是有些服务器在Abort后会自动断开。
    With some servers, when I try to abort a transfer, the client is automatically disconnected from the server, instead of aborting just the transfer. Is this an Indy bug? It probably is not an Indy bug at all. Some servers will close the control connection when the data port connection is closed unexpectedly.