首页 新闻 赞助 找找看

FTP下载问题

0
悬赏园豆:15 [已关闭问题] 关闭于 2012-07-18 15:35

表象上看,好像大文件无法下载。当下载大文件是为0KB。小文件在100KB左右的可以下载。请高手指点。

附上代码

View Code
 1  FileStream outputStream = new FileStream(localfile, FileMode.Create);
 2 
 3                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + remotfile));
 4                 reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
 5 
 6                 reqFTP.UseBinary = true;
 7                 reqFTP.KeepAlive = false;
 8                 reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
 9 
10                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
11 
12                 Stream ftpStream = response.GetResponseStream();
13 
14                 long cl = response.ContentLength;
15 
16                 int bufferSize = 4096;
17 
18                 int readCount;
19 
20                 byte[] buffer = new byte[bufferSize];
21 
22                 readCount = ftpStream.Read(buffer, 0, bufferSize);
23 
24                 while (readCount > 0)
25                 {
26                     outputStream.Write(buffer, 0, readCount);
27 
28                     readCount = ftpStream.Read(buffer, 0, bufferSize);
29                 }
30 
31                 ftpStream.Close();
32 
33                 outputStream.Close();
34 
35                 response.Close();
问题补充:

问题找到了。是因为只能下载英文的文件。中文的不可以。请问如何解决这个问题?谢谢

Bj-Soctt-胖仔的主页 Bj-Soctt-胖仔 | 初学一级 | 园豆:70
提问于:2012-07-13 14:29
< >
分享
所有回答(1)
0

看一下 配置文件的文件大小 设置多少

無限遐想 | 园豆:3740 (老鸟四级) | 2012-07-13 14:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册