libssh2_sftp_read.3 (1509B)
1.TH libssh2_sftp_read 3 "1 Jun 2007" "libssh2 0.15" "libssh2" 2.SH NAME 3libssh2_sftp_read - read data from an SFTP handle 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7#include <libssh2_sftp.h> 8 9ssize_t 10libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, 11 char *buffer, size_t buffer_maxlen); 12.fi 13.SH DESCRIPTION 14\fIhandle\fP is the SFTP File Handle as returned by 15.BR libssh2_sftp_open_ex(3) 16 17\fIbuffer\fP is a pointer to a pre-allocated buffer of at least 18 19\fIbuffer_maxlen\fP bytes to read data into. 20 21Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is modelled 22after the POSIX 23.BR read(2) 24function and uses the same calling semantics. 25.BR libssh2_sftp_read(3) 26will attempt to read as much as possible however it may not fill all of buffer 27if the file pointer reaches the end or if further reads would cause the socket 28to block. 29.SH RETURN VALUE 30Number of bytes actually populated into buffer, or negative on failure. 31It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While 32LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. 33.SH ERRORS 34\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. 35 36\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 37 38\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP - 39 40\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was 41received on the socket, or an SFTP operation caused an errorcode to be 42returned by the server. 43.SH SEE ALSO 44.BR libssh2_sftp_open_ex(3) 45.BR libssh2_sftp_read(3)