In message <CALiegf=+4vr1GU=mn4r0hng99orugtvez+xxjogpbkzx-uz...@mail.gmail.com> 
on Mon, 8 Sep 2014 15:10:04 +0200, Iñaki Baz Castillo <i...@aliax.net> said:

ibc> 2014-09-08 14:44 GMT+02:00 Iñaki Baz Castillo <i...@aliax.net>:
ibc> > ----------------------------------
ibc> > int read = BIO_read(sslBioToNetwork, (void*)myBuffer, MY_BUFFER_SIZE);
ibc> >
ibc> > // Use the read data
ibc> > ----------------------------------
ibc> >
ibc> > with something like this:
ibc> >
ibc> > -----------------------------------
ibc> > long read;
ibc> > char** data = (char**)&myBuffer;
ibc> >
ibc> > read = BIO_get_mem_data(sslBioToNetwork, data);
ibc> >
ibc> > // Emtpy the BIO buffer data, HOW?
ibc> >
ibc> > // Use the read data
ibc> > -----------------------------------
ibc> >
ibc> >
ibc> > But I do not know how to empty the already read BIO buffer data.
ibc> > BIO_flush() does nothing.
ibc> 
ibc> 
ibc> Sorry, BIO_flush() works. The problem is that calling BIO_eof() after
ibc> BIO_flush() does not return 1 so I get a loop. Updated my code not to
ibc> check BIO_eof() after BIO_flush().

Sorry, BIO_flush() isn't what you want (it doesn't reset the buffer to
empty), BIO_reset() is.

However, you need to be careful...  if I were you, I would use the
read data before resetting, as BIO_get_mem_data() gives you the
pointer to the internal BIO_s_mem buffer, not to a duplicate of it.

Cheers,
Richard

-- 
Richard Levitte                         rich...@levitte.org
                                        http://richard.levitte.org/

"Life is a tremendous celebration - and I'm invited!"
-- from a friend's blog, translated from Swedish
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to