From libssh2_channel_write_ex
man page:
Actual number of bytes written or negative on failure. LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Now I have a problem with that. When I receive LIBSSH2_ERROR_EAGAIN
does it mean that nothing was sent and that I must resend all data? Or does it mean that some data have been sent
My problem is that if I'm trying to send more data that the underlying socket can hold, write()
should block anyway, henceforth how can I hope to send a big block of data without getting LIBSSH2_ERROR_EAGAIN
every time?
LIBSSH2_ERROR_EAGAIN means nothing was sent and you must send it all again. If something was sent, that number would be returned instead.