My understanding is that SSL_read is similar to the regular read() call in
its semantics.  That means the m_length arg you supplied is the max number
of bytes to read (so this obviously should be <= size of the buffer
supplied).  It will read what ever is available, up to a max of m_length.
So if you have less data, it will only read that much and return.  If you
have more data, it will read up to m_length and return, and you will have to
issue another read to continue reading the rest of the data.

If you don't want to continue until you have read m_length amount of data,
it sounds like you would want to do that in application logic.  But I'm a
newbie to OpenSSL, so I may not understand the correct semantics of the API.

Ed

 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Tuesday, January 25, 2005 11:46 PM
> To: openssl-users@openssl.org
> Subject: SSL_read() on blocking I/O
> 
> On a blocking TCP socket, I create a blocking BIO using :
> 
> sbio=BIO_new_socket(sockfd,BIO_CLOSE))
> SSL_set_bio(ssl,sbio,sbio);
> BIO_set_nbio(sbio,0);
> SSL_connect(ssl);
> 
> When receiving a message that is longer than 16k, 
> SSL_read(ssl, buffer,
> m_length) returns SSL_ERROR_NONE when exactly 16k are read 
> from the SSL connection.
> 
> I expected (and I would like) SSL_read() to return only when 
> m_length bytes are read.
> 
> Where am I wrong ?
> 
> Cheers,
> 
> Thierry
> 
> --
> Thierry Wouters
> Alcatel Bell n.v.
> Bld Comte de Smet de Nayer 14
> Belgium - 5000 Namur
> [EMAIL PROTECTED]
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to