2

Im using libssh2 in a Qt front end. I have set callbacks to handle receiving and sending by calling libssh2_session_callback_set() (the callbacks read/write data from/to the QTcpSocket). My app can login successfully using keyboard prompt method.

After logging in I open a session(libssh2_channel_open_session(p_LIBSSH2_CHANNEL)) and then request a pty (libssh2_channel_request_pty(p_LIBSSH2_CHANNEL, "vanilla")).

I then run a command (libssh2_channel_exec(p_LIBSSH2_CHANNEL, qbCommand.data())) which is to open a log file on my backend using less and then piping the output to grep to filter some useful infor. This command works successfully when run on the backend using an SSH tool such as Putty or XShell. That is it returns ALL occureneces of the filter. However in my app I can only read the first 65,000 odd characters of the output. I receive data by calling libssh2_channel_read_ex().

Why am I only able to read a limited number of characters off the grep output ?

thanks.

OverTheEdge
  • 749
  • 1
  • 11
  • 17

1 Answers1

0

I managed to receive more data by calling libssh2_channel_flush(p_LIBSSH2_CHANNEL). But the output is not consistent. That is at times I receive the full output of the command (filtered grep output of a log file) and at other times I don't. But however I am receiving much more data than previously.

I flush the channels immediately after calling libssh2_channel_read_ex(). Is this correct ? When should I be calling flush to get a consistent output ?

OverTheEdge
  • 749
  • 1
  • 11
  • 17