On Wed, 15 Apr 2009 00:38:33 -0700, Unknown W. Brackets wrote: > Does waiting for a keypress in the client thread do you any favors? > > Also, you can get some mileage by doing a select() (see SocketSet) on > the socket first. This will tell you if you need to accept(), and also > allow you to do timeouts. I'm a big fan of non-blocking sockets, you > can improve connect() this way too. > > -[Unknown] >
Thanks for all the useful suggestions. I'm on the ticket bandwagon at last. I realise that the code I posted was a bit rough (although I missed the race, which is definitely there). It was a heavily cut-down version of something a lot larger that does indeed use select, uses non-blocking I/ O, retries connection attempts, and even uses Fibers. What I wanted was a small and simple test case to attach to the ticket, not something serious.
