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

Re: About non-blocking mode usage


I confronted this issue as well.  The documentation is lacking in this
area.  It appears that most of the APIs, when they return SSH_AGAIN, it
means that you need to wait until the underlying socket becomes ready for
reading.  I found this to be true for both connection establishment APIs
and command execution APIs.  I suppose that if you issue commands that are
large, ssh_channel_request_exec() could return SSH_AGAIN and require you to
wait until the socket becomes ready for writing, however, I'm not 100% sure
on this.

- Doug

On Thu, Oct 30, 2014 at 4:55 PM, Liang Qin <lqin@xxxxxxxxxx> wrote:

> Does anyone has an example of how to use the non-blocking mode for libssh?
> This include ssh_connect, ssh_userauth functions, ssh_channel functions
> etc. these functions will return again in non-blocking mode, in the test
> examples we see it just keep trying until we get ssh_ok, but this is not
> efficient and will cause high cpu usage, I know we should use poll or
> ssh_poll, but I did not find any docs or examples that shows how to use it.
>
> Could anyone give me some example?
> Thanks
>



-- 
Doug Judd
CEO, Hypertable Inc.

Follow-Ups:
Re: About non-blocking mode usageAris Adamantiadis <aris@xxxxxxxxxxxx>
Re: About non-blocking mode usageAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org