[Libssh] Minor problem with polling/EOF

Matt Lawson lawson08 at yahoo.com
Wed Jan 9 21:33:07 CET 2008


Hi,

I ran into a strange thing.  When communicating with a
remote machine and the remote machine disconnects, I
am able to read everything down to the last character
of the stream that the remote device sent, but when
trying to read the very last char:

channel_is_open() indicates the channel is open

channel_poll() indicates that there 1 char remaining
to be read

channel_read_nonblocking() however can never seem to
read this last character (always returns zero), even
with letting it try many times.

Now my solution was to expose the "channel_is_eof()"
function in libssh.h.  When I call this function, it
indicates that the channel is at EOF.

Not sure if that's the best solution.  Perhaps
channel_is_eof() was intentionally hidden?

Dunno, but this seems to have worked for me.

- matt



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the Libssh mailing list