Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-24 Thread Marek Marcola
Hello, > Marek Marcola wrote: > > For example: > > > > /* check socket error state - only if val == 0 after this call > > * connection is properly established. > > */ > > len = sizeof(int); > > if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *) &state, &len) < 0) { > >

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-23 Thread Darryl Miles
Marek Marcola wrote: For example: /* check socket error state - only if val == 0 after this call * connection is properly established. */ len = sizeof(int); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *) &state, &len) < 0) { goto err;

RE: Non-blocking BIO and BIO_do_connect problem.

2006-07-23 Thread David Schwartz
> I don't know what is supposed to happen in theory, but > in practice I have found select() to be quite a > disaster in informing me when a socket becomes > writable. I have seen this on both Linux and FreeBSD. I have no idea why it gave you a problem. Lots of people do this and you're

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-23 Thread Marek Marcola
Hello, > Girish Venkatachalam wrote: > > I don't know what is supposed to happen in theory, but > > in practice I have found select() to be quite a > > disaster in informing me when a socket becomes > > writable. I have seen this on both Linux and FreeBSD. > > > > select() is very useful and an e

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-23 Thread Darryl Miles
Girish Venkatachalam wrote: I don't know what is supposed to happen in theory, but in practice I have found select() to be quite a disaster in informing me when a socket becomes writable. I have seen this on both Linux and FreeBSD. select() is very useful and an elegant solution for multiplexing

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-23 Thread Dr. Stephen Henson
On Sat, Jul 22, 2006, Girish Venkatachalam wrote: > --- "Dr. Stephen Henson" <[EMAIL PROTECTED]> wrote: > > > > > > > The efficient thing to do depends on the underlying > > transport. > > Getting the actual socket description with > > BIO_get_fd() then calling select() > > while waiting for a

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Girish Venkatachalam
--- "Dr. Stephen Henson" <[EMAIL PROTECTED]> wrote: > On Sat, Jul 22, 2006, Bu Bacoo wrote: > > > Thanks you both... after correcting my > BIO_do_connect (and all > > read/write following it) -> adding retries (as > Girish pointed), it > > works just fine. > > Now I'll check the errors, mentioned

RE: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread David Schwartz
> Thanks you both... after correcting my BIO_do_connect (and all > read/write following it) -> adding retries (as Girish pointed), it > works just fine. > Now I'll check the errors, mentioned by Darryl, to make it more clear, > not just to retry until some counter runs out. Don't do that.

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Dr. Stephen Henson
On Sat, Jul 22, 2006, Bu Bacoo wrote: > Thanks you both... after correcting my BIO_do_connect (and all > read/write following it) -> adding retries (as Girish pointed), it > works just fine. > Now I'll check the errors, mentioned by Darryl, to make it more clear, > not just to retry until some cou

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Bu Bacoo
Thanks you both... after correcting my BIO_do_connect (and all read/write following it) -> adding retries (as Girish pointed), it works just fine. Now I'll check the errors, mentioned by Darryl, to make it more clear, not just to retry until some counter runs out. Thanks. Bu On 7/22/06, Darryl M

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Darryl Miles
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 <[EM

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Girish Venkatachalam
Hello, --- Bu Bacoo <[EMAIL PROTECTED]> 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 This is good news then since it is expected behavior. :-) You are doing nothing wrong till now. However you have to

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Bu Bacoo
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]> w

Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Bu Bacoo
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 = B

Re: Non-blocking BIO and BIO_do_connect problem.

2006-07-22 Thread Bu Bacoo
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);