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

How to wait on a channel for data with channel_poll()


Hi,

In my program, I call channel_request_exec() to execute a remote command,
and right after that, call channel_poll() to check if there are any data
back (The command will get some info from the remote host). But I found,
channel_poll() always return 0 which means no data available, but the remote
command does output something, is it a timing issue? I mean it will take
some time for the command to collect info in the remote host and print them
out, so before anything printed, channel_poll() will always return 0, right?

So how can I wait on a channel for any incoming data?

And another question is how I can know all the data has been received? Why I
ask this question is, if I change my program not to call channel_poll(),
just call channel_read() to read data in a while loop, I found even the
remote command is done, and all its output has been received, channel_read()
still blocks there, so I can not break out from that while loop.


Thanks,
Qian

Follow-Ups:
Re: How to wait on a channel for data with channel_poll()"Oliver Stöneberg" <oliverst@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org