Dr. Stephen Henson wrote:
On Fri, Sep 07, 2007, Jim Marshall wrote:
Jim Fox wrote:
Use "BIO_set_nbio_accept" and this will work as you want it to.
Jim
Arg, thanks Jim - somewhere along the line I mixed that up! Changing to
that causes the BIO_do_accept call to not block. Although BIO_do_accept
returns -1 and errno is set to EAGAIN, the SSL_get_error() function
returns SSL_ERROR_NONE. is that expected?
So beyond the BIO_do_accept, I used the openssl client program to
connect to my server. I was expecting the above to make all the sockets
non-blocking, but when I called SSL_read in my code it seems to block
for data. I tried using the BIO_set_nbio an BIO_set_nbio_accept calls
but no joy.
Basically i am trying to make all the socket calls non-blocking, what am
I missing?
Have you called BIO_set_nbio() on the accept BIO as well?
BIO_set_nbio_accept() makes the accept BIO non blocking so waiting for an
incoming connection does not block.
BIO_set_nbio() makes all subsequent connected BIOs non-blocking.
The SSL_get_error() calls return depends on where you called it. If the BIO
doesn't have an associated SSL structure then the BIO_should_retry() and calls
should be used instead.
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]
Thanks for the feedback, unfortunately I don't fully follow you.
In my code I have a 'opensocket' function in which I do this:
ret = BIO_new_accept(hostString);
if (ret != NULL)
{
BIO_set_nbio_accept(ret, 1);
BIO_set_bind_mode(ret, BIO_BIND_REUSEADDR);
/* bind & listen */
if (BIO_do_accept(ret) < 0)
...
Then i have a function called 'startListening" which I do the following:
acceptRet = BIO_do_accept(sock);
if (acceptRet > 0)
{
BIO* client = NULL;
SSL* ssl = NULL;
client = BIO_pop(sock);
// also tried BIO_set_nbio_accept on the line below
BIO_set_nbio(client, 1);
BIO_set_nbio_accept(client, 1);
ssl = SSL_new(gCtx);
if (ssl != NULL)
{
SSL_set_bio(ssl, client, client);
SSL_set_accept_state(ssl);
...
Am I placing the call in the wrong place?
Thanks
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]