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

channel_poll() is blocking


Hello,
I wrote a little test program to exec a command on a remote host and read the result from channel. Open session, authentification with public keys, exec command, etc. work all fine. But when I try to read something from the channel with this code part from the examples of libssh,
the function channel_poll() is blocking. After a few minutes -1 returned.

Do anyone know, whats wrong?

...
if  (channel_is_open(channel))
{
    while (channel_poll(channel, 0) >= 0)
    {
        buf = buffer_new();
        rc = channel_read_buffer(channel, buf, 0, 0);

        if  (rc < 0)
        {
            buffer_free(buf);
            channel_close(channel);
            ssh_disconnect(session);
            ssh_finalize();
            return 1;
        }

        printf("%s\n", (char *) buffer_get(buf));
        buffer_free(buf);
    }
}
...


Regards,
Thomas

Follow-Ups:
Re: channel_poll() is blockingAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org