Hey
Please check out latest code,
I just added two properties to allow you to cancel either upload or download opration.
Here is a usage example:
using (var sftpClient = new SftpClient(connectionInfo)) { sftpClient.Connect(); var list = sftpClient.ListDirectory(string.Empty); var asynch = sftpClient.BeginUploadFile(File.OpenRead(@"D:\data8.xml"), "small.txt", true, delegate(IAsyncResult ar) { Console.WriteLine("callback called"); sftpClient.EndUploadFile(ar); }, null, (a) => { Console.WriteLine(a); }) as SftpUploadAsyncResult; Thread.Sleep(1000 * 2); asynch.IsUploadCanceled = true; asynch.AsyncWaitHandle.WaitOne(); Console.WriteLine("Finished asynch"); sftpClient.EndUploadFile(asynch); Console.WriteLine("EndUploadFile called"); }
Please check it out and let me know if you have any problems.
Thanks,
Oleg