ftpwebresponse

Using FTP to download each file *WHILE* getting the file list

社会主义新天地 提交于 2019-11-27 23:16:55
We need to get about 100 very small files from a remote FTP server using vb.net. Our company won't let us buy (or install) any 3rd party ftp libraries... so we are forced to use something like FtpWebRequest. (Or is there a better free, choice that is already a part of Visual Studio?) This method works, but it is VERY slow. (I assume because of the constant logging in/out.) Log in with user name and password. Get a file-list from the remote server. Log out Use that file-list to get each file separtely: Log in, get the file, log out. Log in 99 more times, get each file, log out each time.

FtpWebRequest Download File

半城伤御伤魂 提交于 2019-11-27 17:37:04
The following code is intended to retrieve a file via FTP. However, I'm getting an error with it. serverPath = "ftp://x.x.x.x/tmp/myfile.txt"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath); request.KeepAlive = true; request.UsePassive = true; request.UseBinary = true; request.Method = WebRequestMethods.Ftp.DownloadFile; request.Credentials = new NetworkCredential(username, password); // Read the file from the server & write to destination using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) // Error here using (Stream responseStream = response

Using FTP to download each file *WHILE* getting the file list

烂漫一生 提交于 2019-11-26 21:24:19
问题 We need to get about 100 very small files from a remote FTP server using vb.net. Our company won't let us buy (or install) any 3rd party ftp libraries... so we are forced to use something like FtpWebRequest. (Or is there a better free, choice that is already a part of Visual Studio?) This method works, but it is VERY slow. (I assume because of the constant logging in/out.) Log in with user name and password. Get a file-list from the remote server. Log out Use that file-list to get each file