Subject: Re: libssh2_sftp_init() blocks and does not return

Re: libssh2_sftp_init() blocks and does not return

From: Heiner Steven <>
Date: Fri, 20 Mar 2009 15:47:49 +0100

Daniel Stenberg wrote:
> On Wed, 18 Mar 2009, Heiner Steven wrote:
>> Unfortunately it does not work: the program "hangs" in the library
>> call libssh2_sftp_init() and does not return.
> Are you using a blocking or non-blocking socket?

I tried both. As a default I used a blocking socket, resulting in
the symptom decribed. When I modified the code to use a non-blocking
socket (libssh2_session_set_blocking(session, 0)) the function
returns several times (maybe 10, 20 times) with


and blocks afterwards.

>> #0 0x00007f6fe65790d5 in recv () from /lib/
>> #1 0x000000000042a62a in _libssh2_packet_read (session=0x16546d0)
>> at transport.c:362
>> #2 0x00000000004116dd in libssh2_channel_read_ex (channel=0x165ca40,
>> stream_id=0, buf=0x7fffef643a10 "–:dÔˇ\177", buflen=4) at
>> channel.c:1515
>> "strace" shows the process blocking in "recvfrom(3, ...".
>> Is this a known problem?
> No it isn't, but I'll admit I don't do a lot of tests with blocking
> sockets.

The problem also exists with non-blocking sockets.


Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial.
libssh2-devel mailing list
Received on 2009-03-20