1libssh2_sftp_read(3) libssh2 libssh2_sftp_read(3)
2
3
4
6 libssh2_sftp_read - read data from an SFTP handle
7
9 #include <libssh2.h>
10 #include <libssh2_sftp.h>
11
12 ssize_t
13 libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle,
14 char *buffer, size_t buffer_maxlen);
15
17 handle is the SFTP File Handle as returned by libssh2_sftp_open_ex(3)
18
19 buffer is a pointer to a pre-allocated buffer of at least
20
21 buffer_maxlen bytes to read data into.
22
23 Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is mod‐
24 elled after the POSIX read(2) function and uses the same calling seman‐
25 tics. libssh2_sftp_read(3) will attempt to read as much as possible
26 however it may not fill all of buffer if the file pointer reaches the
27 end or if further reads would cause the socket to block.
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 is not 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 re‐
43 ceived on the socket, or an SFTP operation caused an errorcode to be
44 returned by the server.
45
47 libssh2_sftp_open_ex(3) libssh2_sftp_read(3)
48
49
50
51libssh2 0.15 1 Jun 2007 libssh2_sftp_read(3)