Subj : Re: Threading and Timeouts To : comp.programming.threads From : David Schwartz Date : Wed Jul 20 2005 02:01 pm "Giancarlo Niccolai" wrote in message news:dbld49$blc$1@newsread.albacom.net... > After a call of select() which determines that the socket is READY for > I/O, > you are guaranteed to be able to send SOMETHING on the socket. If it's > UDP, > that means that there is enough space to send a datagram, if it's TCP that > at least one byte can be sent without blocking. Nope, that's not what it says. It talks about operations that *WOULD* not block, not operations that *WILL* not block. In other words, it tells you what would have happened to the operation had it already been in progress, not what will happen in the future. > Actually, a write() on a socket will return the number of bytes actually > transmitted, and NOT THE ONES YOU WISH TO TRANSMIT. So, your assertion > "The > simplest example is if you 'write' more bytes than there's buffer space > for. A blocking socket will block until all bytes can be queued." is > wrong, > because if select determines that the socket is ready for write, the > blocking socket WON'T BLOCK and will TRANSMIT IMMEDIATELY the portion of > the data you requested to send that can be transmitted immediately. Huh?! Yes, it will block. It will block until all the bytes can be put in the buffer. It will send immediately and then block. DS .