在C#中通过FTP错误下载大小为160MB的Zip文件

时间:2016-01-22 16:01:11

标签: c# ftp buffer webexception

我正在使用我自己的同步器为库FTPLibrary下载.zip 执行调试时,我在此代码中找到错误

数据: Visual Studio 2012。 Windows Form Aplicattion - C#

#include <string>
#include <iostream>
#include <thread>

using namespace std;

void msg1(string msg) {
    cout << "user1 says: " << msg << endl;
}
void msg2(string msg) {
    cout << "user2 says: " << msg << endl;
}
int main() {
    string message1, message2;
    cin >> message1;
    thread t1(msg1, message1);
    t1.join();
    cin >> message2;
    thread t2(msg2, message2);
    t2.join();
    return 0;
}

更多信息,请参阅FTPLibrary类。第391行出错。

Elerrorestáen:

read = DownloadResponseStream.Read(buffer,0,buffer.Length);

该程序是一个同步器,首先下载一个100 kb的.zip,然后下载150 MB,我们得到以下错误

  

西班牙语: WebException:Se ha terminadolaconexión:错误inesperadoderecepción   中文:基础连接已关闭:意外错误

这导致程序下载150 MB,然后跳转标记和错误,导致您无法使用该文件以备将来操作,程序即将结束。我认为问题出在缓冲区而不是如何修复它。下载文件时,我使用Windows 2003连接到FTP服务器。 谢谢,我希望你能帮助我。

0 个答案:

没有答案
相关问题