[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libssh session connection timed out error

I've downloaded and compiled libssh 0.6.1 from libSSH
<http://www.libssh.org/> .
I also linked the ssh.lib,ssh.dll to a visual c++ project .
The library with code below compiles and run fine ,
but when calling ssh_connect() , it return -1 : Timeout .
I used the option :

ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);

to print the logging , and it says :

ssh_connect : socket connecting now waiting for callbacks to work.
ssh_connect : Timeout connecting to local host.

On my laptop i installed FreeSSHd <http://www.freesshd.com/> server and
connecting to it using putty works .

My code, until the error :

int _tmain(int argc, _TCHAR* argv[])

ssh_session my_ssh_session;
int verbosity = SSH_LOG_PROTOCOL;
int port = 22;
int rc;
char *password;
// Open session and set options
my_ssh_session = ssh_new();
if (my_ssh_session == NULL)
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "localhost");
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
// Connect to server
rc = ssh_connect(my_ssh_session);
if (rc != SSH_OK)
    fprintf(stderr, "Error connecting to localhost: %s\n",

This code example is copied from the A typical SSH session Exmple
<http://api.libssh.org/master/libssh_tutor_guided_tour.html> site .

Good Day
Saeed Hardan

Re: libssh session connection timed out errorAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org