Dr. Stephen Henson wrote:
On Fri, Sep 07, 2007, Jim Marshall wrote:

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?


Add a call BIO_set_nbio(ret, 1) after the call to BIO_set_nbio_accept() in the "opensocket" function.

You shouldn't need the other BIO_set_nbio() calls then.
Thank you, this worked great!

I appreciate your help.
-Jim

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]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to