Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Unable to get download progress/downloaded bytes while using BeginDownloadFile

$
0
0
Hi There,

I am trying to download file(s) from SFTP using BeginDownloadFile. The file is downloaded correctly with no issues but I observed there is no progress information available. The DownloadedBytes is always zero and it shows value at the time when file is about to be written to the disk.

I have also tried the below code I found on Issues page which was about to report progress on upload. This too doesn't show number of bytes uploaded till it finish uploading.
var result = sftp.BeginUploadFile(File.OpenRead(@"C:\bdlog.txt"), "/ftp/Movies/TestMovie/bdlog.txt", (count) =>
                    {
                        Console.WriteLine(count);
                    });

Below code I am trying to download file asyc with progress notification which is not working.

var mem = File.Create(localFileName);
                    var asynch = sftp.BeginDownloadFile(remoteFileName, mem, null, null);
                    var sftpAsynch = asynch as SftpDownloadAsyncResult;

                    while (!sftpAsynch.IsCompleted)
                    {
                        Console.Write(String.Format("\rDownloaded {0} of {1}.", sftpAsynch.DownloadedBytes, 0));
                    }
                    sftp.EndDownloadFile(asynch);

                    sftp.Disconnect();
Could anybody please help me here?

Thanks in advance.
```

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>