[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to wait on a channel for data with channel_poll()
[Thread Prev] | [Thread Next]
- Subject: How to wait on a channel for data with channel_poll()
- From: Qian Zhang <zhq527725@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Sat, 21 May 2011 00:22:18 +0800
- To: libssh@xxxxxxxxxx
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
Re: How to wait on a channel for data with channel_poll() | "Oliver Stöneberg" <oliverst@xxxxxxxxx> |