C# 实现FTP上传与下载

向FTP服务器下载文件的简单实例

Code
                
long cl = response.ContentLength;
                
int bufferSize = 2048;
                
int readCount;
                
byte[] buffer = new byte[bufferSize];

                readCount 
= ftpStream.Read(buffer, 0, bufferSize);
                
while (readCount > 0)
                {
                    outputStream.Write(buffer, 
0, readCount);
                    readCount 
= ftpStream.Read(buffer, 0, bufferSize);
                }
                ftpStream.Close();
                outputStream.Close();
                response.Close();
            }
            
catch (Exception err) 
            { 
                MessageBox.Show(err.Message,
"Download Error");
            }

向FTP服务器上传文件的简单实例

Code
原文地址:https://www.cnblogs.com/ymyglhb/p/1445011.html