.NET 2.0 FtpWebRequest, FtpWebResponse를 이용한 FTP Client Class
示例#1
0
        /// <summary>
        /// FTP 의 원격파일을 다운로드한다.
        /// </summary>
        /// <param name="remoteFile"></param>
        /// <returns></returns>
        private static Stream FtpDownload(string remoteFile) {
            using(new OperationTimer("FTP Download elapsed ")) {
                var stream = new MemoryStream();

                var ftp = new FtpClient("localhost", "anonymous", "");
                ftp.Download(remoteFile, stream);

                stream.Seek(0, SeekOrigin.Begin);
                return stream;
            }
        }
示例#2
0
 /// <summary>
 /// 생성자
 /// </summary>
 /// <param name="hostname">ftp host</param>
 /// <param name="username">접속계정 Id</param>
 /// <param name="password">접속계정 Password</param>
 public FtpFileRepository(string hostname, string username, string password)
 {
     _ftpClient = new FtpClient(hostname, username, password);
 }