On Fri, May 19, 2000 at 05:01:27PM -0700, Michael Farajian wrote:
> Recursive calls to SSL_read() get the server response, but when to STOP calling it 
>is the question I've seen posted here quite often.  Below is a very simplified 
>version of the logic we are using:
>
> The behavior we are seeing is SSL_read returns -1, WSAWaitForMultipleObjects() 
>_immediately_ returns 0 ( WSA_WAIT_EVENT_0), and a subsequent SSL_read will still 
>return -1.
> Finally, when all the data is received from the server, the 
>WSAWaitForMultipleEvents() blocks for 30 seconds and times out, forcing our loop to 
>exit.

Use the SSL_get_error() call on all results, also on the results iErr > 0,
then you will see the cases SSL_ERROR_NONE for successfull completion of
the SSL_read() operation (iErr contains the number of bytes read) and
SSL_ERROR_ZERO_RETURN if the peer has cleanly closed the connection
(and SSL_ERROR_SYSCALL or SSL_ERROR_SSL obviously stating an error).

Best regards,
        Lutz
-- 
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to