From the manpage for select():
those in writefds will be watched to see if a write will not block
For a file descriptor that is associated with a TCP/IP connection, how does the select() function determine when the connection can be written to without blocking? An alternative way of phrasing my question would also be, what are the conditions when select() will return indicating the file descriptor can be written to without blocking?
I'd assume that select() will not return the fd in the fd_set if the send buffer is full. If true, is this the only consideration? I can imagine many possible criteria for determining if a write should block or not, so I'm interesting in knowing specifically how this works on Linux.
It will indicate the FD is writable when there is space in the send buffer. There are no other considerations.
When connecting, this includes the case when the conenction is complete, as the send buffer is effectively allocated at that time.