cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

libssh2_sftp_write.3 (2979B)


      1.TH libssh2_sftp_write 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
      2.SH NAME
      3libssh2_sftp_write - write SFTP data
      4.SH SYNOPSIS
      5.nf
      6#include <libssh2.h>
      7#include <libssh2_sftp.h>
      8
      9ssize_t
     10libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle,
     11                   const char *buffer,
     12                   size_t count);
     13.fi
     14.SH DESCRIPTION
     15\fBlibssh2_sftp_write(3)\fP writes a block of data to the SFTP server. This
     16method is modeled after the POSIX write() function and uses the same calling
     17semantics.
     18
     19\fIhandle\fP - SFTP file handle as returned by \fIlibssh2_sftp_open_ex(3)\fP.
     20
     21\fIbuffer\fP - points to the data to send off.
     22
     23\fIcount\fP - Number of bytes from 'buffer' to write. Note that it may not be
     24possible to write all bytes as requested.
     25
     26\fIlibssh2_sftp_handle(3)\fP will use as much as possible of the buffer and
     27put it into a single SFTP protocol packet. This means that to get maximum
     28performance when sending larger files, you should try to always pass in at
     29least 32K of data to this function.
     30.SH WRITE AHEAD
     31Starting in libssh2 version 1.2.8, the default behavior of libssh2 is to
     32create several smaller outgoing packets for all data you pass to this function
     33and it will return a positive number as soon as the first packet is
     34acknowledged from the server.
     35
     36This has the effect that sometimes more data has been sent off but is not acked
     37yet when this function returns, and when this function is subsequently called
     38again to write more data, libssh2 will immediately figure out that the data is
     39already received remotely.
     40
     41In most normal situation this should not cause any problems, but it should be
     42noted that if you have once called libssh2_sftp_write() with data and it returns
     43short, you MUST still assume that the rest of the data might have been cached so
     44you need to make sure you do not alter that data and think that the version you
     45have in your next function invoke will be detected or used.
     46
     47The reason for this funny behavior is that SFTP can only send 32K data in each
     48packet and it gets all packets acked individually. This means we cannot use a
     49simple serial approach if we want to reach high performance even on high
     50latency connections. And we want that.
     51.SH RETURN VALUE
     52Actual number of bytes written or negative on failure.
     53
     54If used in non-blocking mode, it returns LIBSSH2_ERROR_EAGAIN when it would
     55otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it is not
     56really a failure per se.
     57
     58If this function returns 0 (zero) it should not be considered an error, but
     59that there was no error but yet no payload data got sent to the other end.
     60.SH ERRORS
     61\fILIBSSH2_ERROR_ALLOC\fP -  An internal memory allocation call failed.
     62
     63\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
     64
     65\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP -
     66
     67\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
     68received on the socket, or an SFTP operation caused an errorcode to
     69be returned by the server.
     70.SH SEE ALSO
     71.BR libssh2_sftp_open_ex(3)