Subject: [libssh2] Question about Reading Remote File using SFTP Subsystem

[libssh2] Question about Reading Remote File using SFTP Subsystem

From: Fujiwara, Daisuke <>
Date: Thu, 25 Oct 2007 19:22:25 -0400


I have downloaded libssh2 version 0.18 and compiled one of the sample
programs (example\simple\sftp.c) which came with the library on a
Windows system.

Using this sample executable, I wanted to read a 17 megabyte remote file
using the public key authentication.

I also changed the buffer size from 1024 bytes to 256k bytes in line 224
of example\simple\sftp.c.

So following change is made to the buffer size.


        char mem[1024]; //1k buffer


        char mem[262144]; // 256k buffer

Upon the completion of the first call to "rc =
libssh2_sftp_read(sftp_handle, mem, sizeof(mem));" in line 228 of the

the "rc" variable is assigned "-1" indicating that the reading failed.

Using the libssh2_session_last_error call to retrieve the last error, I
get the error code of -30 and the error message of "Timeout waiting for
status message".

It seems like this buffer limit is imposed around 40k bytes.

Anything below this limit, the remote file can be read using this
library successfully.

Does anyone know why this happens?

Thank you.



The information contained in this message (including any files transmitted
with this message) may contain proprietary, trade secret or other
confidential and/or legally privileged information. Any pricing
information contained in this message or in any files transmitted with
this message is always confidential and cannot be shared with any third
parties without prior written approval from Syncsort. This message is
intended to be read only by the individual or entity to whom it is
addressed or by their designee. If the reader of this message is not the
intended recipient, you are on notice that any use, disclosure, copying or
distribution of this message, in any form, is strictly prohibited. If you
have received this message in error, please immediately notify the sender
and/or Syncsort and destroy all copies of this message in your possession,
custody or control.

This email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>

libssh2-devel mailing list
Received on 2007-10-26