I pull the file from the ftp server, and I have problems with the convenience of my method of verifying the successful completion of the transfer.
There seems to be a more specific way to detect successful transmission. Any ideas?
My code is:
var request = (FtpWebRequest)FtpWebRequest.Create(ftpFilePath); request.KeepAlive = false; request.UseBinary = true; request.UsePassive = false; request.Credentials = new NetworkCredential("Username", "Password"); request.Method = WebRequestMethods.Ftp.DownloadFile; FtpWebResponse response = (FtpWebResponse)request.GetResponse(); using (var stream = response.GetResponseStream()) { using (var reader = new StreamReader(stream)) { contents = reader.ReadToEnd(); } }
Khan source share