[openssl-users] SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE

Serj Rakitov rasjv at yandex.com
Sat Feb 21 10:58:35 UTC 2015


Hello.

I set socket to non-blocking mode.

1. If I do SSL_read() and get result <=0 and then SSL_get_error() returns SSL_ERROR_WANT_WRITE what must I to do?
Is it enough to call SSL_write(ssl,0,0) one time and then again call SSL_read() untill it successed. Is this right?


2.  If I do SSL_write() and get result <=0 and then SSL_get_error() returns SSL_ERROR_WANT_READ what must I to do?
If I must read some data can it be application data or no? So, if I call SSL_read(ssl,buf,buf_size) must I waiting in buf some application data or never?
And after I did SSL_read(ssl,buf,buf_size) then I must again call SSL_write() untill it returns with success?


3. Can be this situation: SSL_write() returns <=0 and then SSL_get_error() returns SSL_ERROR_WANT_WRITE?
What to do in this case for non-blocking socket?


--
Best Regards,

Serj Rakitov


More information about the openssl-users mailing list