Wel, I'd say I am pretty sure... look at below code:
qint64 QxtSshChannel::writeData(const char* buff, qint64 len){
ssize_t ret=libssh2_channel_write_ex(d->d_channel,
d->d_write_stream_id,buff, len);
if(ret<0){
if(ret==LIBSSH2_ERROR_EAGAIN){
return 0;
}else{
#ifdef QXT_DEBUG_SSH
qDebug()<<"write err"<<ret;
#endif
return -1;
}
}
if (len!=ret)
{
qDebug()<<QString("QxtSshChannel::writeData ******FKUP!!!! ssh wrote
less than it should!!! (%1/%2)").arg(ret).arg(len);
}
return ret;
}
Don't mind small writes, it's just testing stage, I will make it bigger
later. Also - this protocol is not based on ssh, as I have stated. It works
via TCP/IP (withour a problem) but when one party is on SSH forwarded port,
write to SSH port fails...
W dniu 10 sierpnia 2011 18:58 u¿ytkownik Henrik Nordström <
henrik_at_henriknordstrom.net> napisa³:
> 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