This month's Index
Subject: When does read block?
When does read block?
From: Seth Willits <seth_at_freaksw.com>
Date: Wed, 9 May 2012 16:52:07 -0700
With typical BSD sockets, if you do a read() and the other end hasn't written anything, read will block forever. With libssh2's channel_read, if the other end hasn't written anything, it doesn't block, it just returns 0 immediately, even after successive calls. (This is on OS X.)
So when exactly does channel_read block? I'm trying to determine exactly if when I should call read(). i.e., if I'm executing an arbitrary command from the user, if it's going to block because there is no output, I don't want to call it.
channel = libssh2_channel_open_session(session);
Reading the documentation and code for libssh2_channel_read_ex, it's not clear when it would return 0 versus actually block and wait until some bytes come through.
-- Seth Willits _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2012-05-10