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

New Post: OperationTimeout and ConnectionInfo.Timeout don't terminate the process

$
0
0
thanks reawakening the thread and for the updates.
i was testing the last commit to see if OperationTimeout works as i predicted.

i set: sftp.OperationTimeout = TimeSpan.FromSeconds(1);
and used asynchronous upload, usinf this code:
                        sftp.ConnectionInfo.Timeout = TimeSpan.FromSeconds(1);
                        sftp.OperationTimeout = TimeSpan.FromSeconds(1);


                        sftp.Connect();



                        using (stream = new MemoryStream(byteArray))
                        {
                            IAsyncResult sftpASynch = sftp.BeginUploadFile(stream, fullPath, null, null);

                            if (!sftpASynch.AsyncWaitHandle.WaitOne(100))
                            {

                                sftp.EndUploadFile(sftpASynch);

                                Console.WriteLine("send file by sftp process was terminated after: " + sftpOperationTimeout + " seconds");

                            }
                        }
                        Console.WriteLine("Send by SFTP finished. Path:" + fullPath);
after some seconds (although OperationTimeout was set to 1 second) the file was uploaded to the server and was not terminated as supposed to.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



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