Subj : Re: Threading and Timeouts To : comp.programming.threads From : David Schwartz Date : Sat Jul 23 2005 07:00 pm "Giancarlo Niccolai" wrote in message news:dbt7vp$shc$1@newsread.albacom.net... > David, (or anyone else) how do this part of the standard interacts with > the > select() function? > > """ > 2.10.11 Socket Receive Queue > > A socket has a receive queue that buffers data when it is received by the > system until it is removed by a receive call. > """ This does not mean that the receive call is the only way to remove data from the buffer. Otherwise, if you call 'close', the data would remain around forever. This is talking about the typical case, not providing guaranteed semantics. > While select() does not ensures that a ready for receive socket will be > still ready a bit after, this should ensure that if the socket is found > ready for read because of incoming data, that data will be still available > later on. Even if you 'close' the socket? Even if the network protocol provides a way to revoke data and the data is revoked? > Of course, there's the case in which the socket is found ready for read > for > any other reason (i.e. socket close on remote side), in which it is still > unspecified what happens next (i.e. you may immediately see socket close > with a read or be forced to wait). Exactly. This is saying the purpose of the socket buffer, not guaranteeing semantics in corder cases. > Also, this part doesn't explicitly says that, even if the data is ready on > the queue, read() has to return it without blocking... That's true. There could be network protocol that only send whole blocks to the application and if the whole block is not available, 'read' would still block. > Can you confirm I am reading this part of the standard correctly? I wouldn't read too much into this part. I think it's just saying that you need to put the data somewhere and what the purpose of that buffer would be. It's not trying to document every possible operation on the buffer or its contents. For one thing, that would be protocol specific. DS .