On Wed, 25 Mar 2015, Lars Nordin wrote:
and I get 2000 bytes each time. The testfile is 116K.
Let me explain in rough terms why you see this 2000 bytes data and how the libssh2 SFTP code works.
The SFTP code will take your given buffer size and split it into 2000 bytes chunks and ask the server for such data packets, as many as can fit in your buffer.
A 20000 buffer thus ends up asking for 10 such packets - at once. libssh2 will then return data back as soon as there is data to return, which initially could be a single 2000 bytes packet but over time should become a whole bunch of such packets assuming the bandwidth is good enough.
This concept is used because SFTP requires ACKs for ever packet it asks for so it better ask for a whole bunch at once to suffer less RTT pains.
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel