[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need Help Regarding::SSH blocking and Non-Blocking Mode

On 4/5/21 12:28 PM, V Sidnal, Nagraju wrote:
Hi All,

When I’m creating a session, by default it create blocking session.

If I use same blocking session to call *SSH_CONNECT(SESSION),* with timeout of 30 Seconds, For Invalid IP address it gets return after 30 seconds.

When I set this to nonblocking by using *ssh_set_blocking(SESSION,0)**, If now, I do SSH_CONNECT(SESSION),* it returns immediately with*SSH_AGAIN.*

It means in nonblocking mode I need to try *SSH_CONNECT(SESSION) *repeatedly, until my expected timeout value  or return SSH_OK, example in my case for 30 seconds.

Apart from above observation, What is the impact of  blocking and non-blocking mode?

Which one is recommended. Which one to use in which scenarios.

It only shifts the responsibilities between your application and the library. If you do not want to bother with timeouts, using blocking mode is better for your application. If you have work to be done in the meantime or you use some custom polling, non-blocking operations (not just connect) are more suitable for your application.

Jakub Jelen
Senior Software Engineer
Crypto Team, Security Engineering
Red Hat, Inc.

Need Help Regarding::SSH blocking and Non-Blocking Mode"V Sidnal, Nagraju" <nagraju.sidnal@xxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org