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

New Post: Slow failure reading non-existing file using SCP

$
0
0
Hi,

Thanks for having a look. Interesting. The 'server' is a proprietary Linux device we manufacture. I need to investigate further.

The way you use the ScpClient is different to my implementation, I wonder if I'm using it wrong. Here is a code frag of my code:
            using (var stream = new MemoryStream((128 * 1024)))
            {
                var hasError = false;
                using (var scpClient = new ScpClient(XXX.IpAddress, XXX.UserName, XXX.Password))
                {
                    scpClient.ErrorOccurred += (x, y) => hasError = true;
                    scpClient.BufferSize = BufferSize;

                    scpClient.Connect();

                    if (scpClient.IsConnected && !hasError)
                    {
                        try
                        {
                            scpClient.Download(_sourcePath, stream);
                        }
                        catch (ScpException exception)
                        {
                            // logging stuff here ... do get the "file or directory not found".
                        }

                        scpClient.Disconnect();
                    }
                }

                // consume stream here as 'stream.ToArray()'
            }

Viewing all articles
Browse latest Browse all 1729

Trending Articles



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