Subject: writing to channel limited to 2 Mb?

writing to channel limited to 2 Mb?

From: Przemys³aw Szczygielski <>
Date: Wed, 10 Aug 2011 17:26:31 +0200


I am trying to implement my own file transfer protocol and encountered a
problem when client or server is connected via libssh2 (the protocol works
flawlessly on "normal" network).

I am writing small amounts of data (not more than 4096 bytes) to ssh
channel, using libssh2_channel_write_ex. Up to 2Mb sent, the function
returns actual bytes written. But around 2Mb (the boundary is not constant,
but it fails around 2093051, 2080764, 2083684 or 2092906) it begins
returning 0 and of course - no data reaches destination.

If I transfer a file that is a bit smaller than 2Mb - it goes through, the
channel gets OK response and I can send another less than 2Mb file (it seems
that reading my protocol's "OK" message from ssh channel somehow unclogs

I googled around for "libssh2" and "2097152" finding several posts
describing, I guess, similar problem.

This may be also connected with windows RDP protocol forwarded via
libssh2_channel_forward_listen_ex problem. I can connect to forwarded
channel and log in, but as soon as I log in and a huge amount of data
(current remote screen) is to be written to libssh channel, the connection
hangs - surely there's more than 2Mb of data written to the channel...

Is this a bug, a feature or am I just doing something wrong?



Received on 2011-08-10