[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with ssh_scp_write() function
[Thread Prev] | [Thread Next]
- Subject: Problem with ssh_scp_write() function
- From: Thomas Mayer <tm.telemotive@xxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 08 Aug 2011 15:09:13 +0200
- To: libssh@xxxxxxxxxx
Hi,I wrote a little test program to copy a file from local to remote host. But I think there is some problem with the ssh_scp_write() function. When I run my program (source code below) without the mssleep() function, only a very small file is created and the the programm exit without a error. With the mssleep() function all things work correctly and the file is copied complete.
Any idea what I'm doing wrong? /// Test programFirst I do the basic stuff like authentication, init new scp session, open local file to read and get local file size, etc...
Then I do (reduced source code): ssh_scp_push_directoryssh_scp_push_directory(scp, ".", S_IRWXU); ssh_scp_push_file(scp, "testFile.zip", localSize, S_IRUSR | S_IWUSR); while (remoteSize != localSize) { count = fread(buffer, 1, sizeof(buffer), localFile); if (ssh_scp_write(scp, buffer, count) != SSH_OK) { qDebug() << "[ERROR] SshConnect::writeScpData: write error"; fclose(lFile); return -1; } msleep(20); // it don't works correct without that remoteSize += count; } Thanks in advance, Thomas
Fix for ssh_scp_write issue | Einar Fløystad Dørum <einarfd@xxxxxxxxxxxxx> |