This month's Index
Subject: libssh2_channel_read returning different format for same command
libssh2_channel_read returning different format for same command
From: Ty Oh <tyoh_at_cct-solutions.com>
Date: Fri, 4 Jan 2013 14:37:24 +0100
I am using libssh2_channel_write and libssh2_channel_read to communicate with a server that accepts commands.
I'm facing a problem where the returned data is not always in the same format for the same command.
Because, the data is tab and newline delimited, it is impossible to adjust and fix the read data.
As far as I can see.
- The results are random.
- The first read is always good.
- Only occurs to large data returned. E.g. 20k
- Sometimes it will go wrong on the second time the command was sent, or sometimes on the 17th repeat etc.
I'm certain that this is not a server problem.
Anyone had such issues?
Here's a snip of the read function.
string SSHManager::ReadResponse(LIBSSH2_CHANNEL *channel)
//keep reading until terminator is received. \nt\n
if (readBytes < 1)
if(readBytes < bufSize)
if (r.length() > 2)
Thanks and Best regards,