[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject:
- From: Achmad Fathoni <fathoni.id@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 30 Jun 2021 11:28:45 +0700
- To: libssh@xxxxxxxxxx
I am trying to make a simple connection to SFTP server using libssh0.9.5 with this program. //https://api.libssh.org/master/libssh_tutor_sftp.html#sftp_read #include <libssh/libssh.h> #include <libssh/sftp.h> #include <iostream> using namespace std; int main(){ ssh_session sshs = ssh_new(); if(sshs == NULL){ cerr << "Error allocating SSH session: " << ssh_get_error(sshs) << endl; return SSH_ERROR; } //using hostname doesn't work either. ssh_options_set(sshs, SSH_OPTIONS_HOST, "192.168.2.15"); ssh_options_set(sshs, SSH_OPTIONS_USER, "reach"); //This is fine int rc = ssh_connect(sshs); if(rc != SSH_OK){ cerr << "Error connecting to localhost: " << ssh_get_error(sshs) << endl; return SSH_ERROR; } //Error is here sftp_session sftps = sftp_new(sshs); if(sftps == NULL){ cerr << "Error allocating SFTP session: " << ssh_get_error(sshs) << endl; return SSH_ERROR; } sftp_free(sftps); ssh_disconnect(sshs); ssh_free(sshs); return 0; } Above program prints `Error allocating SFTP session: sftp_new: Out of memory` . I can connect to SFTP in reach@192.168.2.15 using other software. Can somebody help me?
Re: | Jakub Jelen <jjelen@xxxxxxxxxx> |