libssh2_channel_read_ex.3 (1691B)
1.TH libssh2_channel_read_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2" 2.SH NAME 3libssh2_channel_read_ex - read data from a channel stream 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7 8ssize_t 9libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, 10 char *buf, size_t buflen); 11 12ssize_t 13libssh2_channel_read(LIBSSH2_CHANNEL *channel, 14 char *buf, size_t buflen); 15 16ssize_t 17libssh2_channel_read_stderr(LIBSSH2_CHANNEL *channel, 18 char *buf, size_t buflen); 19.fi 20.SH DESCRIPTION 21Attempt to read data from an active channel stream. All channel streams have 22one standard I/O substream (stream_id == 0), and may have up to 2^32 extended 23data streams as identified by the selected \fIstream_id\fP. The SSH2 protocol 24currently defines a stream ID of 1 to be the stderr substream. 25 26\fIchannel\fP - active channel stream to read from. 27 28\fIstream_id\fP - substream ID number (e.g. 0 or SSH_EXTENDED_DATA_STDERR) 29 30\fIbuf\fP - pointer to storage buffer to read data into 31 32\fIbuflen\fP - size of the buf storage 33 34\fIlibssh2_channel_read(3)\fP and \fIlibssh2_channel_read_stderr(3)\fP are 35macros. 36.SH RETURN VALUE 37Actual number of bytes read or negative on failure. It returns 38LIBSSH2_ERROR_EAGAIN when it would otherwise block. While 39LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. 40 41Note that a return value of zero (0) can in fact be a legitimate value and 42only signals that no payload data was read. It is not an error. 43.SH ERRORS 44\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 45 46\fILIBSSH2_ERROR_CHANNEL_CLOSED\fP - The channel has been closed. 47.SH SEE ALSO 48.BR libssh2_poll_channel_read(3)