On Tue, 16 May 2006, Wei Li wrote:

On Mon, 15 May 2006 21:40:22 -0400 (EDT), "Mikhail Kruk"
<[EMAIL PROTECTED]> said:
When using nonblocking BIO, can SSL_write(ssl, ...) be called right
after a SSL_read(ssl, ...) "returned" SSL_ERROR_WANT_READ/WRITE? Or vice
versa, please?

Always assume that a non-blocking SSL_read and SSL_write can return both
WANT_READ and WANT_WRITE.  It's not as difficult as they want you to
think.


The manual says SSL_read() should be repeated if a previous one returned
WANT_READ/WRITE. And, I meant, can SSL_write() be called before this
repeating is done, please?

Assuming that we are talking about a regular tcp non-blocking socket, the answer is yes. SSL_read() is just telling you that your request can't be satisfied at the moment and should be retried after more data is read (written) from (to) the socket. You don't have to do anything in response to that. The usual thing to do is to block using select() or something similar, but you don't have to. Calling SSL_write is OK to. Of course it will most likely fail with the same error, so maybe you do want to select(). But it is ok (as in "will work", not as in "The Right Thing To Do") to just blindly keep trying calling SSL_read and SSL_write.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to