> This is on SuSE 10.3. The socket is non-blocking, for the only reason
> that I thought it would make debugging the problem easier.

Debugging non-blocking sockets is much more complex than blocking ones.

> With the socket in blocking mode (which is all I need), I have the
> problem where SSL_connect never returns.

That's not a problem. It's still trying to connect. If it never succeeds nor
fails, then it will hang forever. That's what non-blocking does. If you
don't want that behavior, then blocking mode is not all you need.

> I'm looking at errno becuase the information returned by SSL_get_error
> wasn't very useful.

?!?!

> To recap, here's the results of all the various debugging that I have in
place:
> SSL_connect: -1
> SSL_get_error: 2

Well, there you go. You got SSL_ERROR_WANT_READ. You need to 'select' or
'poll' until the socket is readable.

> A few other notes, I am connecting to the openssl/s_server, so that end
> should be OK. This is all happening inside of a multi-threaded app,
> which could be part of the problem. In a separate, very simple
> (and non-threaded) client app which I wrote, I can connect via TCP and
> SSL and transmit/read just fine. So that rules out machine/network level
stuff.

Well, your code is obviously broken for non-blocking sockets because it
doesn't handle SSL_ERROR_WANT_READ correctly.

> I have also tried calling SSL_connect in a loop, just to test to see
> if waiting/re-calling helps, but it doesn't. The same error occurs
> each time.

Go back to blocking mode or implement proper handlers for
SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to