Hi. 

I'm just starting out with the OpenSSL library, and I've got a problem that
I don't know how to fix.

I'm trying to read data using SSL_read() from a non-blocking socket on a
Windows machine. 

The problem is that when the SSL_read returns SSL_ERROR_WANT_READ, I don't
know how to wait for data to become available.

My code is something like:

    fd_set tSet;
    FD_ZERO(&tSet);

    SOCKET tSocketFD = SSL_get_fd(pSSL); // Get the underlying socket.
    FD_SET(tSocketFD, &tSet);

    int tNumSocketsReady = select(1, &tSet, NULL, NULL, &tTimeout);    

    if (tNumSocketsReady)
    {
        tRetVal = SSL_read(pSSL, buf, num);
    }
    else
    {
        tRetVal = SOCKET_ERROR;
    }

However, this doesn't work -- the select() call always returns immediately. 

I've been banging my head against
http://www.openssl.org/docs/ssl/SSL_read.html but it just says:

    The calling process then must repeat the call after taking 
    appropriate action to satisfy the needs of SSL_read(). 
    The action depends on the underlying BIO.

What SSL function acts like select() on ordinary sockets? Is there some kind
of event I can wait on?

Thanks for listening!

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

Reply via email to