[openssl-users] Problem with not knowing how much data is available to read

counterpoint martin at black-sheep-research.com
Sat Dec 19 15:00:05 UTC 2015

This is a further question, related to my earlier question "Find size of
available data prior to ssl_read".  The conclusion seemed to be that there
isn't a reliable way to know how much data can be requested with ssl_read.

I guess there's still something wrong with my understanding. My code now
reads data into a fixed sized buffer, and keeps reading until no data is
received. But the problem is, the last read gets an SSL_ERROR_WANT_READ
error. That seems to imply that I can't do any more reads or writes until
the read is successfully retried, but being prevented from writing will
block the system because the client is expecting a reply (which has to be
written) before sending anything more for me to read. Do I really need to
suppress writes while waiting for a retry of a read that encountered
SSL_ERROR_WANT_READ, or is that a misunderstanding on my part?

(In many cases, I can tell there is no more data because the value returned
by ssl_read is less than the size of the buffer. But there must be the case
when the data received exactly fills the buffer, and then it is only by
reading again that I discover there is no more data).

View this message in context: http://openssl.6102.n7.nabble.com/Problem-with-not-knowing-how-much-data-is-available-to-read-tp61790.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

More information about the openssl-users mailing list