[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ Wrapper, getting started
  [Thread Prev] | [Thread Next]
 
 
- Subject: C++ Wrapper, getting started
 - From: "Emre Soranlar" <EmreS@xxxxxxxxxxxxxxxx>
 - Reply-to: libssh@xxxxxxxxxx
 - Date: Fri, 15 May 2015 09:13:45 +0300
 - To: <libssh@xxxxxxxxxx>
 
Hi Dave,
 
You should set port number and verbosity for the connection. And make
sure the ssh is active on the remote computer. See the my connection, (
this is C code but there is no difference in c++ )
 
        int verbosity = SSH_LOG_PROTOCOL;
        int port = 22;
        char *password = "test";
        int rc;
 
        ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST,
"192.168.56.102");
        ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY,
&verbosity);
        ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
        ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "user");
 
        rc = ssh_connect(my_ssh_session);
        if ( rc == SSH_OK )
        {
            EventLogger::LogMessage(true, "Connection succeded %d", rc);
        }
        else
        {
            EventLogger::LogMessage(true, "ssh_connect failed %d", rc);
            return false;
        }
 
        rc = ssh_userauth_password(my_ssh_session, NULL, password);
        if ( rc == SSH_AUTH_SUCCESS )
        {
            EventLogger::LogMessage(true, "Authenticate succeded %d",
rc);
        }
 
 
 
Try that way, this is working on my machine properly.
 
 
 
EMRE SORANLAR
Ankara University
Software Engineer 
Environmental Tectonics Corp/ Turkey / ODTU
 
Archive administrator: postmaster@lists.cynapses.org