Are you sure it returns 0 and not an error?
And why such small writes if you are doing file transfers? Bigger writes makes better use of ssh framing and compression.
----- Ursprungsmeddelande -----
> Hello,
>
> 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 it...)
>
> 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?
>
> Regards,
>
> Przemek.
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-08-10