Hi,
I started using libssh to develop a program that creates a reverse SSH tunnel
and monitors it, however I got stuck in an early stage of the process. I
followed the tutorial on the libssh website and tried to setup an ssh
connection. The connection fails and I get the following output in the terminal:
[2015/09/23 16:00:56.991535, 1] ssh_connect: libssh 0.6.4 (c) 2003-2014 Aris
Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the
LGPL, please reger to COPYING file for information about your rights, using
thrading threads_noop[2015/09/23 16:00:57.007158, 3] getai: host
xxx:xxx:xxx:xxx matches an IP address[2015/09/23 16:00:57.007158, 1]
ssh_connect_host_nonblocking: Failed to connect: No error[2015/09/23
16:00:57.007158, 2] ssh_socket_connect: Nonblocking connection socket: -1
As you can see no specific error information and I have been stuck with this
for a while now. I'm using Windows 10 with Visual Studio 2010. I followed the
tutorial for importing libssh in your project at this page:
http://stackoverflow.com/questions/8204259/how-to-use-libssh-in-vs10
Any help would be really appreciated. If you need more information please ask
me for it.
Kind regards,Lars
This is my code:#include "stdafx.h"
#include <stdio.h>#include <stdlib.h>#include <time.h>#include
"filelogger.h"#include <libssh\libssh.h>
#include <errno.h>#include <string.h>
int _tmain(int argc, _TCHAR* argv[]) { std::FileLogger myLog ("0.1",
"SVlog.txt");
int verbosity = SSH_LOG_DEBUG;
ssh_session my_ssh_session; my_ssh_session = ssh_new();
int rc;
if (my_ssh_session == NULL) { myLog << "[ERROR]
my_ssh_session could not be created!"; exit(-1); }
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "xxx.xxx.xxx.xxx");
ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "user");
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); rc =
ssh_connect(my_ssh_session);
if (rc != SSH_OK) { myLog << "[ERROR] The connection was
not succesfull"; exit(-1); }
/* Close connection */ ssh_disconnect(my_ssh_session);
ssh_free(my_ssh_session); return 0;}