Red-M / RedSSH

Use SSH in python easily with C speed!
Other
20 stars 3 forks source link

`read()` timeout for SFTP or SCP #6

Closed brendan-simon-indt closed 2 years ago

brendan-simon-indt commented 2 years ago

Does the read() method for SFTP or SCP need a timeout?

I want to write a GUI app that can perform operations on multiple targets simultaneously. How can I do that without blocking, but still get feedback of progress, etc?

I'm thinking that asyncio or threads will be required. Is this something that RedSSH handles transparently (does it use asyncio or threads) or do I have to do the asyncio/threading myself.

I that possible (or should be possible) with RedSSH or is it more in the domain of redlibssh?

Is there a better forum to ask questions and discuss options? Stack Overflow or somewhere else?

Thanks, Brendan.

Red-M commented 2 years ago

As per the documentation, there is no timeout. These calls will block but the entire library is thread safe so you can use async or threads to handle this (each session is thread safe, so multiple calls to the same session won't be sped up by threading but multiple sessions will be).

Redlibssh and Redlibssh2 are not going to help here as these are just bindings libraries for use in RedSSH, you might be better off using RedExpect for more control around using SSH commands.