Subject: Re: libssh2_sftp_read reads a number of bytes smaller than both the file size and the specified buffer size

Re: libssh2_sftp_read reads a number of bytes smaller than both the file size and the specified buffer size

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 4 Apr 2012 00:02:54 +0200 (CEST)

On Tue, 3 Apr 2012, Peter Stuge wrote:

>> It means 30K was sent off and that you need to call it again with the
>> remaining 170K. In a very similar fashion to how write() and similar
>> function calls work.
>
> So _sftp_write() is different from _channel_write() here? It does not need
> to be called again with the same data, when it reports some success - only
> when it returns EAGAIN?

None of them should be called again with the same data when success has been
returned and some amount of data has been sent off.

The SCP and SFTP examples are pretty similar in this aspect and show this.

In the SFTP upload case, an application will even work faster if it
"top-fills" the buffer and passes in 200K in the subsequent call again (if
there is more data to send).

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-04-04