1libssh2_sftp_read(3) libssh2 manual libssh2_sftp_read(3)
2
3
4
6 libssh2_sftp_read - read data from an SFTP handle
7
9 #include <libssh2.h> #include <libssh2_sftp.h>
10
11 ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
12 size_t buffer_maxlen);
13
14
16 handle is the SFTP File Handle as returned by libssh2_sftp_open(3)
17
18 buffer is a pointer to a pre-allocated buffer of at least
19
20 buffer_maxlen bytes to read data into.
21
22 Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is mod‐
23 elled after the POSIX read(2) function and uses the same calling seman‐
24 tics. libssh2_sftp_read(3) will attempt to read as much as possible
25 however it may not fill all of buffer if the file pointer reaches the
26 end or if further reads would cause the socket to block.
27
28
30 Number of bytes actually populated into buffer, or negative on failure.
31 It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
32 LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure
33 per se.
34
36 LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
37
38 LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
39
40 LIBSSH2_ERROR_SOCKET_TIMEOUT -
41
42 LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was
43 received on the socket, or an SFTP operation caused an errorcode to be
44 returned by the server.
45
46
48 libssh2_sftp_open(3) libssh2_sftp_readnb(3)
49
50
51
52libssh2 0.15 1 Jun 2007 libssh2_sftp_read(3)