title: How is it possible to have send timeout on a non blocking socket?
body: <p>I have some problems understanding the working of sockets in Linux. </p>
  
  <pre><code>setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &amp;timeout, sizeof(int));
  write = write(sockfd, buf, len);
  </code></pre>
  
  <p>In the above code as writes are buffered, send timeout doesn't make any sense(write system call will return immediately when the user space buffer is copied into the kernel buffers). Send buffer size is much more important parameter, but send timeout seems it does nothing worthwile. But I am certainly wrong, as I have seen quite a lot of code which uses SO_SNDTIMEO. How can user space code timeout using SO_SNDTIMEO assuming that the receiver is very slow?</p>