Subject: [libssh2] libssh2_channel_read_stderr always in blocking mode ?

[libssh2] libssh2_channel_read_stderr always in blocking mode ?

From: Thomas Harding <thomas.harding_at_laposte.net>
Date: Tue, 31 Jul 2007 18:14:13 +0200

Hello,
I'm trying to extend/improve python binding of libssh2.
         ^(I'm a beginner in C coding)

My problem is that while using libssh2_channel_read_stderr,
it seems to wait infinitely for data when no data is available,
whatever channel is or is not in blocking mode.

I saw a message in the june's archives about that:
[libssh2] More progress in converting to nonblocking
(by James Housley)

I (half) solved the problem in non-blocking mode by polling
for POLLERR (it seems to differs from the unix poll,
as POLLERR is normally not significant in pollfd struct)
"half", because since an error occurs, calling libssh2_poll
on POLLERR success everytime. In that case, reading for
stderr sipmly returns nothing (it doesn't block).

As you can expect, calling poll in blocking mode results
in an infinite wait.

Also, I have a problem with libssh2_channel_eof in blocking mode:
When the stream is emptied at the last libssh2_channel_read call,
a call to libssh2_channel_eof does not return 1
(eg, after a "libssh2_channel_exec", with "cat mbox" as command)
However, it returns 1 if I try "cat xulu", reads for stderr stream, and
checks again for eof.

I agree that checking for the returned value will allows to know if
the data lenght was the asked buffer lenght, but what appends when
waiting for output, then another output for a long time ?

So, can libssh2_channel_read_ex be turned in non blocking mode for
any stream, or am I wrong in what I expect from these functions?

Regards,

-- 
Thomas Harding
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-07-31