> Come down to the details, I am having trouble using select() a
> read/write file descriptor to make BIO_do_connect a non-blocking call,
> before BIO_do_connect() returns, BIO_get_fd() will return -1. Without a
> file descriptor, how can I use select()?

Now that I think about, maybe your misunderstanding is elsewhere. You talk
about "using select()" to "make BIO_do_connect a non-blocking call". The
'select' function has no effect on whether an operation blocks or not and
cannot make a blocking function non-blocking. In the usual context, you use
'fcntl' or 'setsockopt' to do this. For SSL BIOs, you can use BIO_set_nbio
for this purpose.

My man pages say:

       BIO_set_nbio() sets the non blocking I/O flag to n. If n is zero then
       blocking I/O is set. If n is 1 then non blocking I/O is set. Blocking
       I/O is the default. The call to BIO_set_nbio() should be made before
       the connection is established because non blocking I/O is set during
       the connect process.
...
       BIO_do_connect() attempts to connect the supplied BIO. It returns 1
if
       the connection was established successfully. A zero or negative value
       is returned if the connection could not be established, the call
       BIO_should_retry() should be used for non blocking connect BIOs to
       determine if the call should be retried.

As I said previously, you must not call 'select' until directed to do so.
For example, 'BIO_should_retry' can direct you to do so.

DS


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

Reply via email to