DirectoryListing slow?
Hi, first off I would like to say thank you for your explicit documentation and great work on the WinSCP project.
Now, for my problem. I am developing a backup utility in C# which uses a connection over SCP to recover data stored on a NAS Box. My problem at the time being, is that whenever I do a directory listing in WinSCP itself, it is very fast (< 1 sec.), but when I do it with my program, it typically takes about 4-5 seconds. This is not workable for the experience I'm trying to create. Is this a known problem or is there a way to speed things up (except from caching)?
I have pasted the code I am currently using (nothing out of the ordinary I suppose) and have also doublechecked other methods. From the moment I start the thread until it is completed, it takes way to long and it is doing that on ListDirectory. Thanks in advance for your reply.
Now, for my problem. I am developing a backup utility in C# which uses a connection over SCP to recover data stored on a NAS Box. My problem at the time being, is that whenever I do a directory listing in WinSCP itself, it is very fast (< 1 sec.), but when I do it with my program, it typically takes about 4-5 seconds. This is not workable for the experience I'm trying to create. Is this a known problem or is there a way to speed things up (except from caching)?
I have pasted the code I am currently using (nothing out of the ordinary I suppose) and have also doublechecked other methods. From the moment I start the thread until it is completed, it takes way to long and it is doing that on ListDirectory. Thanks in advance for your reply.
class WinSCPSession { #region Fields private SessionOptions sessionOptions; private string pathToWinSCP; #endregion public WinSCPSession(SessionOptions sessionOptions, string pathToWinSCP) { this.sessionOptions = sessionOptions; this.pathToWinSCP = pathToWinSCP; } public void GetDirectoryInfo(object threadItem) { ThreadInfo threadInfo = (ThreadInfo)threadItem; String remotePath = (String)threadInfo.param; try { using (Session session = new Session()) { session.Open(sessionOptions); session.ExecutablePath = pathToWinSCP; RemoteDirectoryInfo dirInfo = session.ListDirectory(remotePath); AsyncHelper.BeginInvoke(threadInfo.completed, dirInfo.Files); } } catch (Exception e) { Log.Error(e); } } }