Subject: Re: proper buffer size for libssh2_sftp_read()

Re: proper buffer size for libssh2_sftp_read()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 15 Jun 2011 09:23:34 +0200 (CEST)

On Wed, 15 Jun 2011, zl liu wrote:

> I get a problem when i download a file about 20M bytes via non-blocking
> mode.

We need more details. I've successfully transfered much larger downloads than
20M over SFTP - many times.

Is this with 1.2.8? On what operating system? What server software is on the
other end?

> if the mem size if 1024 or 1024 * 10. it will success.

But the downside will of course be that transfers will never be very fast with
such a small buffer...

> [libssh2] 6.535906 Failure Event: -7 - Unable to send transfer-window
> adjustment packet, deferring

Interesting. -7 is LIBSSH2_ERROR_SOCKET_SEND returned from
_libssh2_transport_send, which afaics only can occur if send() really returns
an error that isn't EAGAIN. Is the problem repeatable? Can you add some
logging of exactly what is stored in errno when the LIBSSH2_ERROR_SOCKET_SEND
is returned?

Is that -7 line the first error you can spot in the trace output?

> [libssh2] 6.515906 Failure Event: -24 - Remote sent more data than current
> window allows, truncating

That seems like a side-effect from the previous failure. When this happens I
think it all goes downhill and badness is all over.

> another question , why not define the MACRO :LIBSSH2DEBUG in the debug mode.
> when i want to enable trace,i must define the macro LIBSSH2DEBUG manually
> and compile it again.

That's what we have "./configure --enable-debug" for!

-- 
  / daniel.haxx.se

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-06-15