www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Cannot set up sftp connection?

Cannot set up sftp connection?

From: Steven Van Ingelgem <steven_at_vaningelgem.be>
Date: Wed, 1 Jul 2009 16:50:31 +0200

Hi,

I am trying to set up an sftp connection, but it seems that I cannot
enumerate files in a directory.

The calls I do are basically:
sess = libssh2_session_init();
<create socket>
libssh2_session_startup(sess, socket);
sftp = libssh2_sftp_init(sess);
libssh2_session_set_blocking(session, 1);
libssh2_sftp_open(sftp, path.c_str());
libssh2_sftp_readdir_ex(handle, filename, sizeof(filename), longentry,
sizeof(longentry), &attrs);
==> In this call it hangs indefinetly

That is the call to "rc = sftp_packet_requirev(sftp, 2, fopen_responses,
sftp->open_request_id, &data, &data_len);" around line 914 in sftp.c...

What could be the cause?

Thanks,
Steven

Hereby the debug log outputted from libssh2:

[libssh2] 1.082106 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
[libssh2] 1.123225 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
[libssh2] 1.123336 Transport: Packet type 94 received, length=18
[libssh2] 1.123629 Conn: 9 bytes packet_add() for 0/0/0
[libssh2] 1.123990 Conn: channel_read() got 4 of data from 0/0/0
[libssh2] 1.124551 Conn: Adjusting window 39321600 bytes for data on channel
0/0
[libssh2] 1.124821 Conn: channel_read() filled 4 adjusted 4
[libssh2] 1.125115 SFTP: Data begin - Packet Length: 5
[libssh2] 1.125393 Conn: channel_read() got 5 of data from 0/0/0 [ul]
[libssh2] 1.125677 SFTP: Received packet 2 (len 5)
[libssh2] 1.125959 SFTP: Asking for 2 packet
[libssh2] 1.126203 SFTP: Got 2
[libssh2] 1.126524 SFTP: Enabling SFTP version 3 compatability
[libssh2] 1.126815 Conn: Setting blocking mode ON
[libssh2] 1.127413 SFTP: Sending directory open request
[libssh2] 1.127515 Conn: Writing 42 bytes on channel 0/0, stream #0
[libssh2] 1.127835 Conn: Sending 42 bytes on channel 0/0, stream_id=0
[libssh2] 1.128165 SFTP: Asking for 102 packet
[libssh2] 1.128358 SFTP: Asking for 101 packet
[libssh2] 1.128729 SFTP: recv packet
[libssh2] 1.249561 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
[libssh2] 1.249793 Transport: Packet type 94 received, length=26
[libssh2] 1.250061 Conn: 17 bytes packet_add() for 0/0/0
[libssh2] 1.250393 Conn: channel_read() got 4 of data from 0/0/0
[libssh2] 1.250924 SFTP: Data begin - Packet Length: 13
[libssh2] 1.251251 Conn: channel_read() got 13 of data from 0/0/0 [ul]
[libssh2] 1.251533 SFTP: Received packet 102 (len 13)
[libssh2] 1.251759 SFTP: Asking for 102 packet
[libssh2] 1.252079 SFTP: Open command successful
[libssh2] 1.252521 SFTP: Reading entries from directory handle
[libssh2] 1.252713 Conn: Writing 17 bytes on channel 0/0, stream #0
[libssh2] 1.253015 Conn: Sending 17 bytes on channel 0/0, stream_id=0
[libssh2] 1.253296 SFTP: Asking for 104 packet
[libssh2] 1.253547 SFTP: Asking for 101 packet
[libssh2] 1.253854 SFTP: recv packet
[libssh2] 1.305652 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-07-01

the libssh2 team