www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

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 23:04:27 +0200 (CEST)

On Wed, 4 Apr 2012, Adam Craig wrote:

> Thank you. That resolves my original question. I suppose most users of the
> API would not need to worry about chunk size.

The API is designed and intended to make _no_ users have to care about it.

> In my case, speed is a factor

I suspect most users want it to run as fast as possible!

> I wanted to see how downloading in larger chunks would affect performance.
> My understanding is that using larger packets and thus uploading or
> downloading in fewer calls can be faster up to a point but that it also
> increases the cost of lost packets and increases the chance that some of the
> data in a given packet will become corrupted in transit. I will try some
> other sizes and see.

You need the complete picture of what is going on to be able to draw such
conclusions and given the above explanation it seems to me that you're
simplifying way too much.

Since SFTP packets need to be individually acked, and libssh2 won't consider
such a packet complete until the ACK has been received, you need to consider
how fast you can send N bytes over a connection with a certain RTT and a
maximum packet size of 32K or so, using this API.

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

the libssh2 team