On Sat, 14 Jun 2014, Nitin Deokate wrote:
> 1. I have an application, where I use libssh2_sftp_read(), and I pass
> larger buffer(say 8K to 16MB) to same function,
>
> What I expect is, data of same bytes, but all I get is 2000Bytes.
No, that is probably all you get in the first read call. That's quite a
difference. In subsequent reads you are likely to get larger pieces.
> What could help me to get as equal to the buffer size I passed and not 2000
> bytes?
If you have less latency to the server you may get more, but the first call is
likely to always just give you a small piece.
> 2. Is it any significant reason for selecting value for
>
> #define MAX_SFTP_READ_SIZE 2000
>
> Why it canąt have more bytes than that?
It can, just bump it. But you will not get the amount you ask for at once, you
can up to that amount, then you call the function over and over again until
you're done.
> Has anybody faced this scenario before, please revert as early as possible.
I don't even understand your scenario. We have users downloading insane
amounts of data over SFTP with no problems. This is not a known problem
you're talking about.
The 2K number is simply the "block size". libssh2 sends read MANY requests
with that size and as soon as one comes back it can return data. When you call
read again, more packets might already have arrived and can be returned and so
on. I blogged about this technique when I made this change:
http://daniel.haxx.se/blog/2010/12/08/making-sftp-transfers-fast/
-- / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2014-06-14