On Mon, Nov 26, 2001 at 11:39:26AM +0100, Rygg Christian Ingemann wrote:

> I'm making a few objects that are communicating with eachother using SSL. It
> almost works now, but I want my client to read from the connection until
> there are no more to read, without knowing how much the server is sending. I
> thought using SSL_pending() would do the trick. However, the call to
> SSL_pending() always returns 0, even though there is something to read: If I
> comment it out, the client reads line after line, but hangs when there is no
> more to read. Why does it return 0 if there is something to read?

SSL_pending() does not read new data from the network, it only looks
at any bytes that may be remaining from previous calls to SSL_read().

If you have to avoid hanging, you should use non-blocking sockets.
Then you can do trial SSL_read() calls to check for new data.  Make
sure to read the SSL_get_error() manual page (or its online version at
<URL:http://www.openssl.org/docs/ssl/SSL_get_error.html>)



-- 
Bodo Möller <[EMAIL PROTECTED]>
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to