Right, but let's say I'm doing an SSL_write, and I get a WANT_READ error.  I
then select on the socket until data is available for reading.  I then call
SSL_read.  If all that was sent was the protocol data that the write was
waiting for to satisfy the ssl state machine, and no application data was
sent, would SSL_read return the number of bytes actually read off the socket
(which is just protocol data), or would it read that transparently and
return 0 indicating that no application data was read?  Or would it just
read the required protocol data and return an error of WANT_READ to indicate
that I should retry the SSL_read when more data arrives?  Now that I think
about it, I'm guessing the latter.




> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, April 17, 2005 9:48 PM
> To: openssl-users@openssl.org
> Subject: Re: Confusion about SSL_ERROR_WANT_READ/WRITE
> 
> A return result of 0 typically means the other side closed 
> the connection.
> 
> Here is the section from SSL_read's man page with regards to 
> a 0 return:
> 
>         0   The read operation was not successful. The reason 
> may either 
> be a
>             clean shutdown due to a "close notify" alert sent 
> by the peer (in
>             which case the SSL_RECEIVED_SHUTDOWN flag in the 
> ssl shutdown state
>             is set (see SSL_shutdown(3), 
> SSL_set_shutdown(3)). It is also pos-
>             sible, that the peer simply shut down the 
> underlying transport and
>             the shutdown is incomplete. Call SSL_get_error() 
> with the return
>             value ret to find out, whether an error occurred 
> or the connection
>             was shut down cleanly (SSL_ERROR_ZERO_RETURN).
> 
> 
> -Joe
> 
> 
> 
> On Apr 17, 2005, at 9:12 PM, Edward Chan wrote:
> 
> > Does SSL_read always return the number of bytes of application data 
> > read?
> > If so, that means that SSL_read could return 0, and that 
> this should 
> > not be construed as an error.
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to