This problem was raised on this mailing list many times, but the clear solution (in my opinion) was not given. From OpenSSL FAQ: ...an SSL connection may not concurrently be used by multiple threads... This means that I can't have 2 threads, one reading and one writing at the same time from the same socket. My application is basic Jabber communicator (messager) I should to constantly listen on socket for incoming messages and at the same time send messages written by me.(this is not communication model like for example in http: request,response,request,response.etc.) If I use simple TCP connection I create 2 threads one reading, one writing. This is simple,fast and correct.(reding and writing are blocking). But when have to SSL connection this is much more complicated. I'm using Delphi and Indy components. There are sugesstion on mailing list that concurrent socket usage can be avoided by creating non-blocking socket and mutex, which is locked when any thread is using socket. But non-blocking socket is more complex to implement and forces me to not use Indy component, since Indy components are desined to work only in blocking mode (for TCP sockets this is correct design, I've read that Indy 10 has an option in core to work in non-blocking mode but I don't known if this option is exposed to user the same way as in socet API (maybe it was added to other purposes), but I have Indy 9 and don't want to upgrade). So using nonblocking sockets forces me to implement everything in native socket API, using OpenSSL API (currently Indy does it internally) and deal with additional complexivity of nonblocking sockets.
Is there any OpenSSL function similar to socket API 'select' (SSL_select) ???? If yes, then I can use blocking sockets. One thread is waiting in blocking SSL_select for incoming messages, If massage will come then this thread will try to acquire mutex and then carry out blocking SSL_read which will not block because there is message on socket. I can't do this with socket API 'select' because it signals any data on socket not exactly data on which SSL_read will not block. (TLS renogotiation or something like this). I hope you known what I mean. (I have tried with SSL_pending but it return 0 even if there are data on socket) Any suggestions? Can someone help me with this? Lucas ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]