Subj : Re: Threading and Timeouts To : comp.programming.threads From : Charles Bryant Date : Mon Jul 25 2005 10:56 pm In article <42de49df$0$70709$e4fe514c@news.xs4all.nl>, Casper H.S. Dik wrote: >Giancarlo Niccolai writes: > > >>Select works with WinSocks too, although with a couple of minor, irrelevant >>differences (i.e. the first parameter, that is, maxfd + 1, is ignored). > >That's not really a irrelevant difference; the caller of select is >free to put garbage in the sets past the index of maxfd. There's another very relevant difference. From: ! Any two of the parameters, readfds, writefds, or exceptfds, can be given ! as null. At least one must be non-null, and any non-null descriptor set ! must contain at least one handle to a socket. This is very non-intuitive and a considerable nuisance. It means that if you have a program where you need to accommodate a varying number of sockets being used with select(), you need to have special handling for the cases where there happen to be no sockets currently in each of the sets. It also means that the common idiom to get a microsecond-resolution pause: select(0, 0, 0, 0, x) breaks on Windows. .