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

New Post: Slow Performance .... help!!

$
0
0
OK. Since your code won't compile (SshClient has no DownloadFile), I wrote some code for pseudo measurement myself:
        private static void DownloadFile(string ip, string user, string password, string file)
        {
            using (var client = new SftpClient(ip, user, password))
            {
                client.Connect();
                var filestream = new FileStream("bla", FileMode.OpenOrCreate);
                var start = DateTime.Now;
                client.DownloadFile(file, filestream);
                var end = DateTime.Now;

                var timespan = TimeSpan.FromSeconds((end - start).TotalSeconds);
                var size = (new FileInfo("bla").Length / 1024) / 1024;

                Console.WriteLine("{0} {1}", timespan.TotalSeconds , size);

                var speed = size/timespan.TotalSeconds;

                Console.WriteLine("Speed: {0} MB/s", speed);
            }
        }
(I know this code is not very good for performance measurements ;))

I get around 4-5 MB/s while downloading a 100MB file or a 1GB file
My bottleneck is my not so fast linux nas ^^

Btw, why is nobody able to paste his real code? That is quite frustrating..

Viewing all articles
Browse latest Browse all 1729

Trending Articles