Thomas Hruska wrote: > So I'm over on the openssl-users mailing list quite effectively baiting > a flame war on select(). At this point it is just me and some other guy > going back and forth on the intricacies of select(). He says that > select() does NOT guarantee that a recv() that follows will be > non-blocking while MSDN Library says the contrary: > > http://msdn2.microsoft.com/en-us/library/ms740141.aspx > > "The parameter readfds identifies the sockets that are to be checked for > readability...<snip bind()/listen() stuff>...For other sockets, > readability means that queued data is available for reading such that a > call to recv, WSARecv, WSARecvFrom, or recvfrom is guaranteed not to block." > > My target platform is Windows (obviously). > > So, under what circumstances would a select() immediately followed by a > recv() fail to be non-blocking despite the documentation saying > otherwise? Assume only a single thread of a single process has access > to the socket handle/ID. > > And, while I'm at it, I was under the general impression that select() > under Windows was roughly the same under Linux. Does the above also > apply there? The manpages don't really say either way (but maybe I just > missed it). You would think critical behavior like that would be > documented somewhere.
I think I'm slowly coming to the realization that I've been doing socket programming _WRONG_ for the past 7 years. Still waiting on feedback from my last message (to openssl-users), but if the answer is what I think it is, I will have to spend my weekend rewriting large chunks of code. And it will make for an interesting anecdote in Second Edition. I've always thought socket programming was a little odd but couldn't put my finger on it. And should it turn out that it was because I was writing the code incorrectly, that will prove to be the most enlightening (and embarrassing) thing to happen since, well, I can't remember the last time I've been properly enlightened/embarrassed. It has been years. And here I thought I knew everything ;) -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
