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

Re: libssh2_sftp_init() blocks and does not return

From: Daniel Stenberg <>
Date: Fri, 20 Mar 2009 16:28:10 +0100 (CET)

On Fri, 20 Mar 2009, Heiner Steven wrote:

>> 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.

Why does it return that 10-20 times? Do you call it immediately in a

What function blocks with a non-blocking socket? That surely can't hang on the
recv() then at least...

>> 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.

I've done quite a lot of tests with non-blocking and I've not seen this, and
I've also got reports from others who've done the libcurl-based (~30) tests
without experiencing this. It might indicate that the problem happens only in
more specific situations, like with a particular server on a particular OS or
something else...

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