Subj : Re: Threading and Timeouts To : comp.programming.threads From : Giancarlo Niccolai Date : Wed Jul 20 2005 12:47 pm Joe Seigh wrote: > MC wrote: >> Hi all, >> > > Use non-blocking i/o with select() or poll(). Or just indicate i/o > has timed out without "canceling" it, just let the i/o complete normally. > Socket connections can't be shutdown instantaneously anyway. > > Actually, I found that blocking i/o with select or poll works fine. Once select returns signaling that a socket can be read/written, a single read/write operation is GUARANTEED not to block; that's exactly what select is for. However, when using nonblocking sockets on select() loops I observed some weird behavior in some systems (i.e. older linuxes). To my best knowledge, non-blocking sockets are a mean to poll a single socket from your program without selecting it. Bests, Giancarlo Niccolai .