I have some code that does a sort of read buffering scheme. I need to be
able to tell if
n characters are available to read, and if so to read them. I tried to
use SSL_pending()
to do this, but found that upon entering for the first time,
SSL_pending() _always_
returned 0. I am also not convinced that SSL_pending() will ever equal n
if n is large.
So now I am doing an SSL_read(_,&toss,0) before the SSL_pending()
as a way to "kick start" things and keeping a buffer of data read so
far. If the buffer isn't
large enough and if SSL_pending() says there's something there (after
being kick-started),
then the buffer is extended until either it's long enough or until
kick-starting fails to
yield a non-zero SSL_pending(). I am not convinced this is the best way
to achieve
the desired result.

1. Is SSL_read() really non-blocking? It will really return 0 if there's
nothing to read?
Will it return short reads (SSL_read(_,_,65536)<65536)? Always or only
if it runs out
of data to read?

2. Can I presume that SSL_read() will return non-zero if either
SSL_pending() returns
non-zero or if select() says that the underlying file descriptor has
data waiting? How
else would I? SSL_peek(_,toss,1)?

3. Will a 0 length read assure that SSL_pending() returns non-zero if
there's anything
available?


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to