This project is read-only.

question regarding OperationTimeout and the connection info timeout

Sep 25, 2012 at 12:26 AM

I'm trying to clear up my understanding several of the timeouts.

For example SftpClient has the "OperationTimeout" property. Is this a timeout that dictates how long the library will attempt to process the next command? (such as "DownloadFile" or "RenameFile").  So if I set the OperationTimeout to 30 seconds, it will attempt to start the process for 30 seconds before exiting?

With the ConnectionInfo object, there is a "Timeout" property. Is this Timeout the total time the connection will stay alive? Or is this how long it will attempt to make a connection before exiting?

Thank you for your feedback and assistance.

Jan 22, 2013 at 10:45 PM

I'd also like to understand exactly what OperationTimeout is and how it is used. Anyone?

Jan 23, 2013 at 2:10 PM


The idea of OperationTimeout is that you can provide a timeout for specific operation separately and Connection Timeout is a global connection timeout for any SSH protocol operation.

After looking at a code of SFTP I probably did not do the best job of separating it so might need to looked at it again. But the way it works now is if you specify Operation Timeout 15s and Connection timeout 30s then if you performing any SFTP operation and no response were received for request sent within 15 sec it will throw an exception but connection still be active since.

I guess the best way where OperationTimeout used in SshClient where you can specify timeout for each command you execute seperatly so this way if you have long running operation you can specify different timeout and I think I just tried apply same principles to SFTP operations.


Hope it somewhat explains it. If you have any suggestions on how to improve it please let me know.




Jan 23, 2013 at 2:22 PM

Hi Oleg,

That sounds reasonable. The only thing I am still not 100% sure about OperationTimeout is if this applies to for instance a complete file download in SftpClient, i.e. if you specify 30s for OperationTimeout and you do a DownloadFile then the file has to complete the entire download in 30s. After doing a simple test this does not seem to be the case. What timeout is in affect during the actual download of the file? Is the timeout reset after each packet received from the server until the entire file is downloaded, e.g. timeout exception will occur if no data is received for 30s from server during a file download?


Jan 23, 2013 at 2:30 PM



No its not the case,

Its timeout to receive response back from the server.

So for example download file or upload file might take 10000 messages to send to complete operation so timeout between sending 1 message and getting response that this message was received by the server should be no longer then 30 seconds for example.


Same principle goes to SFTP but in SFTP case there are SFTP sepcific messages so smae idea, how many times should pass between sending SFTP request and getting response back that request was received and processed by the server.


Hope it makes more sense, its may be a little bit more technical but this is what I meant by timeouts.



Jan 23, 2013 at 2:39 PM
Edited Jan 23, 2013 at 2:39 PM

Perfect, that clears it up for me, thank you Oleg.