Hello > On Sat, Aug 19, 2006 at 11:58:27PM +0200, Marek Marcola wrote: > > In this situation calling SSL_read() next time is enough > > (SSL layer will continue to write its own data and after this > > read real data) but this SSL_read() should be performed > > when socket descriptor is ready for write now. > > Hi Marek, > > I think I've fixed my problem. Thanks for setting me in the right > direction. I've forget to pay your attention on other problem that may appear with code like:
do { ret = SSL_read(sslobject, buf, bufsz); err = SSL_get_error(sslobject, ret); } while (ret <= 0 && (err == SSL_ERROR_WANT_READ)); (of course I assume that WANT* works ok now). The problem is that depending on variable bufsz this loop may iterate some times getting application data from SSL layer and putting this data in the same place (overwriting existing). For example assume that in SSL layer we have 400 bytes ready to read and that bufsz is 100 bytes. This loop will iterate 4 times (and after this you will get WANT* error) placing every 100 bytes in the same place. At the end you will get only 100 last bytes from 400 ready to read. And next information, SSL_read() if has something in SSL buffers return no more data than in buffers. This means that if you request 100 bytes and in SSL layer exists 10 bytes from previous reads then you will get only 10 bytes - no additional try to read some bytes from network will be performed. Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]