Re: Simple non-blocking TCP connect

2008-10-28 Thread Gabriel Soto
On Mon, Oct 27, 2008 at 11:03 PM, David Schwartz <[EMAIL PROTECTED]> wrote: > >> > I was thinking about an alternate solution, using blocking sockets, >> > and doing the connect on another thread. If the user cancels the >> > operation I'd close the socket (BIO_free) and I guess the connect >> > wo

RE: Simple non-blocking TCP connect

2008-10-27 Thread David Schwartz
> > I was thinking about an alternate solution, using blocking sockets, > > and doing the connect on another thread. If the user cancels the > > operation I'd close the socket (BIO_free) and I guess the connect > > would return with an error and the thread would exit then. Seems a > > little dirty

RE: Simple non-blocking TCP connect

2008-10-27 Thread David Schwartz
> I was thinking about an alternate solution, using blocking sockets, > and doing the connect on another thread. If the user cancels the > operation I'd close the socket (BIO_free) and I guess the connect > would return with an error and the thread would exit then. Seems a > little dirty but it co

Re: Simple non-blocking TCP connect

2008-10-27 Thread Gabriel Soto
Michael S. Zick wrote: > On Fri October 24 2008, David Schwartz wrote: >> > - - - - >> >> Notice how this assumes that if BIO_sock_error returns zero, the connection >> completed? This is a bogus inference. The absence of an error just means the >> connection attempt has not failed *yet* and tells

Re: Simple non-blocking TCP connect

2008-10-24 Thread Michael S. Zick
On Fri October 24 2008, David Schwartz wrote: > - - - - > > Notice how this assumes that if BIO_sock_error returns zero, the connection > completed? This is a bogus inference. The absence of an error just means the > connection attempt has not failed *yet* and tells you nothing about how it > wil

RE: Simple non-blocking TCP connect

2008-10-24 Thread David Schwartz
Gabriel Soto wrote: > { > // Create BIO with some random nonexistent host. > BIO *bio = BIO_new_connect("192.168.9.9:"); > > if (bio == NULL) { > // Failed to obtain BIO. > return false; > } > > // Set as non-blocking. > BIO_set_nbio(bio, 1); > > //

Re: Simple non-blocking TCP connect

2008-10-24 Thread Gabriel Soto
Gabriel Soto wrote: > > Greetings. > I'm a noob trying to code a simple TCP client (Windows, MinGW, OpenSSL > 0.9.8g). Since it has a GUI, I have to go with non-blocking sockets. > > I'm supplying a nonexistent host to test a failure but this is what happens: > A first call to connect returns natu