Bu Bacoo wrote:
Instead of modifying the BIO, I've also tried to set it's socket to
non-blocking mode. Same result, BIO_do_connect returns -1
BIO* pBio = BIO_new_connect((char*)conn.c_str());
BIO_socket_nbio(BIO_get_fd(pBio,NULL), 1);
BIO_do_connect(pBio); //returns -1
On 7/22/06, Bu Bacoo <[EMAIL PROTECTED]> wrote:
Sorry for typo, should be pBio instead of m_pBio everywhere.
On 7/22/06, Bu Bacoo <[EMAIL PROTECTED]> wrote:
> Hello, I'm having problem with BIO_do_connect, when trying to setup
> non-blocking behaviour for it.
>
> When using:
> BIO* pBio = BIO_new_connect((char*)conn.c_str());
> BIO_set_nbio(m_pBio,0); //returns 1
> BIO_do_connect(m_pBio); //returns 1
> it works just fine,...
>
> .. but with non blocking:
> BIO* pBio = BIO_new_connect((char*)conn.c_str());
> BIO_set_nbio(m_pBio,1); //returns 1
> BIO_do_connect(m_pBio); //returns -1
>
> It doesn't connect. Why could that be? Any idea please.
And if you do this:
while(1) {
int rv = BIO_do_connect(m_pBio);
if(rv < 0) {
// Fix this line below with correct detection for a fatal or
non-fatal error, if BIO_do_connect() returns a fatal error we want to
abort, if BIO_do_connect() returns an expected non-fatal error we need
to delay and try again.
if(errno != EINPROGRESS)
break; // fatal error
// wait a bit and try again
sleep(1);
}
}
I am not familiar with BIO and nonbocking connects but the the connect()
system call will return -1/EINPROGRESS when the connect is not yet
connected but still working on establishing a connection.
Just a thought for you.
Darryl
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]