Hi, There's something in the examples that sounds strange to me.
In the write loop of some non blocking examples, we have: do { nread = fread(mem, 1, sizeof(mem), local); if (nread <= 0) { /* end of file */ break; } ptr = mem; do { /* write data in a loop until we block */ while ((rc = libssh2_sftp_write(sftp_handle, ptr, nread)) == LIBSSH2_ERROR_EAGAIN) { ; } ptr += rc; nread -= nread; } while (rc > 0); } while (1); In the inner do while loop, shouldn't it be: ptr += rc; nread -= rc instead of this curious: ptr += rc; nread -= nread; => after this; nread is always 0 (right ?) and if rc returned by libssh2_sftp_write was < nread, then the next loop will be in fact rc = libssh2_sftp_write(sftp_handle, ptr, 0)... Other question: when libssh2_sftp_write returns LIBSSH2_ERROR_EAGAIN, why not do a select() on the socket instead of recall libssh2_sftp_write immediately which I presume is consuming CPU cycles? JL ------------------------------------------------------------------------------ _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel