[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'Short sftp packet error' in libssh
[Thread Prev] | [Thread Next]
- Subject: Re: 'Short sftp packet error' in libssh
- From: Mani Amoozadeh <mani.amoozadeh2@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 14 Nov 2016 16:29:19 -0800
- To: libssh@xxxxxxxxxx
Following the last email I don't see any options to change chunk
size when copying a file to the remote computer:
#include <libssh/sftp.h>
#include <sys/stat.h>
#include <fcntl.h>
int sftp_helloworld(ssh_session session, sftp_session sftp)
{
int access_type = O_WRONLY | O_CREAT | O_TRUNC;
sftp_file file;
const char *helloworld = "Hello, World!\n";
int length = strlen(helloworld);
int rc, nwritten;
...
file = sftp_open(sftp, "helloworld/helloworld.txt",
access_type, S_IRWXU);
if (file == NULL)
{
fprintf(stderr, "Can't open file for writing: %s\n",
ssh_get_error(session));
return SSH_ERROR;
}
nwritten = sftp_write(file, helloworld, length);
if (nwritten != length)
{
fprintf(stderr, "Can't write data to file: %s\n",
ssh_get_error(session));
sftp_close(file);
return SSH_ERROR;
}
rc = sftp_close(file);
if (rc != SSH_OK)
{
fprintf(stderr, "Can't close the written file: %s\n",
ssh_get_error(session));
return rc;
}
return SSH_OK;
}
On 11/14/2016 08:28 AM, Mani Amoozadeh
wrote:
|
Re: 'Short sftp packet error' in libssh | Mani Amoozadeh <mani.amoozadeh2@xxxxxxxxx> |
'Short sftp packet error' in libssh | Mani Amoozadeh <mani.amoozadeh2@xxxxxxxxx> |
Re: 'Short sftp packet error' in libssh | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
Re: 'Short sftp packet error' in libssh | Mani Amoozadeh <mani.amoozadeh2@xxxxxxxxx> |