Hi,

I have the following code snippet:

bio = BIO_new_connect(host);
BIO_set_conn_port(bio, port);
BIO_set_nbio(bio, 1)
while (true) {
    status = BIO_do_connect(bio);
    if (status > 0 || !BIO_should_retry(bio)) {
        break;
    }
    sleep(1);
}

BIO_do_connect() always returns -1 the first time and 1 the 2nd time, 
regardless if the server is reachable or not.

If I use the blocking mode, then it returns 1 on reachable server and hangs 
otherwise, which seems expected.

Is there anything wrong in the above code, why it returns the same value for 
reachable or non-reachable servers?

Regards,
-binlu

Reply via email to