Subject: Re: writing to channel limited to 2 Mb?

Re: writing to channel limited to 2 Mb?

From: Przemysław Szczygielski <>
Date: Thu, 11 Aug 2011 10:51:09 +0200

> Are you using the API in a blocking or non-blocking way?
> Non-blocking.

> If non-blocking: your code should already be prepared to handle EAGAIN and
> act accordingly when that happens => call libssh2_session_block_**directions()
> to see what to wait for, then wait and then call libssh2 again when things
> happen.
Well, it isn't exactly my code, as it is part of a library that is a wrapper
to libssh2:

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);



            return 0;



            qDebug()<<"write err"<<ret;


            return -1;



    if (len!=ret)


******KRYTYCZNY!!!! do SSH zapisalo mniej niz dostalo!!!


    return ret;


So instead of "return 0" I should call libssh2_session_block_directions()
and wait until either read or write to channel is available, depending on
block_directions result?

Received on 2011-08-11