求源码ftp!
我现在要实现一个这么功能:在某个设定的时间,调用ftp到某个ip的指定文件夹下载“更新后”的文件到本机某个文件夹下!
谢谢! --------------------编程问答-------------------- using System.Net;
using System.Text;
using System.IO;
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp.sunlike.cn/my.ini");
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential("uid", "pwd");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("Download Complete, status {0}", response.StatusDescription);
reader.Close();
response.Close();
这段代码只能将文件解码成字符哦。如果你是其它文件就会出错。你可可转换下就可以了.
补充:.NET技术 , C#