C# Chilkat FTP2下载(GetFile)大文件(≈12 GB)

C# Chilkat FTP2下载(GetFile)大文件(≈12 GB),c#,ftp,chilkat,C#,Ftp,Chilkat,我一直在尝试使用Chilkat.Ftp2下载大约12GB大小的大文件 一切似乎都很好,但是。。在我可以看到的日志中,下载往往以100%的速度失败: 同时调用ftp.Noop;不时地,保持连接的活力 我是不是遗漏了什么 编辑:下载并重试的一些伪代码 设置ftp.LargeFileMeasures=true应该可以解决问题。PS>除非有充分的理由,否则不要修改SoSndBuf/SoRcvBuf属性。另外,您可能需要被动模式,如果您真的要继续下载,最好只设置RestartNext。谢谢您的回复!另外

我一直在尝试使用Chilkat.Ftp2下载大约12GB大小的大文件

一切似乎都很好,但是。。在我可以看到的日志中,下载往往以100%的速度失败:

同时调用ftp.Noop;不时地,保持连接的活力

我是不是遗漏了什么

编辑:下载并重试的一些伪代码


设置ftp.LargeFileMeasures=true应该可以解决问题。

PS>除非有充分的理由,否则不要修改SoSndBuf/SoRcvBuf属性。另外,您可能需要被动模式,如果您真的要继续下载,最好只设置RestartNext。谢谢您的回复!另外一个问题是,在ftp.OnPercentDone事件上使用ftp.Noop是否值得?由于重新启动下一步通常需要1.5小时的文件下载时间,由于下载时间太长,而且通常会下载多个文件,因此如果失败,我总是尝试恢复。。我注意到,百分比会重置,这意味着如果恢复时失败率为50%,它将再次从0%开始,这将添加一些代码,说明我如何尝试恢复失败的下载谢谢@Matt似乎我的问题已经解决了。。另外,你能看看我的重试代码吗?它是否有任何重大问题,为什么在恢复下载百分比计数后再次从0%开始? GetFile: DllDate: Jul 30 2019 ChilkatVersion: 9.5.0.79 UnlockPrefix: NONE Architecture: Little Endian; 32-bit Language: .NET 4.7 / x86 VerboseLogging: 0 originalGreeting: 220 Titan FTP Server Ready. remotePath: /fo/bar/export_20190819.zip localPath: \test\export_20190819.zip ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring downloadToFile: localFilePath: \test\export_20190819.zip Replacing existing local file downloadToOutput2: modeZ: 0 binaryMode: 1 setupDataConnection: passive transfer mode setupPassiveDataSocket: sendCommand: sendingCommand: PASV --sendCommand readCommandResponse: WindowsError: An existing connection was forcibly closed by the remote host. WindowsErrorCode: 0x2746 maxToReceive: 65536 Failed to receive data on the TCP socket Failed to read FTP control channel reply. readFtpReply: Socket fatal error. --readCommandResponse --setupPassiveDataSocket Failed to setup passive data socket --setupDataConnection Failed to setup data connection for download. readRepliesAfterFailedDataConn: readCommandResponse: Failed to read FTP control channel reply. readFtpReply: Socket connection closed. --readCommandResponse --readRepliesAfterFailedDataConn --downloadToOutput2 downloadToOutput: Elapsed time: 18953 millisec --downloadToFile Failed. --GetFile --ChilkatLog
ftp.EnableEvents = true;
ftp.RestartNext = true;
ftp.Passive = false;
ftp.SoSndBuf = 131072;
ftp.SoRcvBuf = 131072;
        string fileName = _ftp.GetFilename(i);
        string remoteFilePath = sourcePath + fileName;
        string destinationFilePath = destinationPath + fileName;
        bool success = _ftp.GetFile(remoteFilePath, destinationFilePath);

        if (success)
        {
            Log($"Downloading Finished {fileName} : {DateTime.Now.ToString("HH:mm:ss")}");
        }
        else
        {
            Thread.Sleep(30000);
            success = _ftp.GetFile(remoteFilePath, destinationFilePath);
        }