title: Case when blocking recv() returns less than requested bytes
body: <p>The <a href="http://man7.org/linux/man-pages/man2/recvmsg.2.html" rel="noreferrer"><code>recv()</code></a> library function man page mention that:   </p>
  
  <blockquote>
    <p>It returns the number of bytes received. It normally returns any data available, up to the requested amount, rather than waiting for receipt of the full amount requested.</p>
  </blockquote>
  
  <p>If we are using blocking <code>recv()</code> call and requested for 100 bytes:</p>
  
  <pre><code>recv(sockDesc, buffer, size, 0); /* Where size is 100. */
  </code></pre>
  
  <p>and only 50 bytes are send by the server then this <code>recv()</code> is blocked until 100 bytes are available or it will return receiving 50 bytes.</p>
  
  <p>The scenario could be that:   </p>
  
  <ul>
  <li><p>server crashes after sendign only 50 bytes   </p></li>
  <li><p>bad protocol design where server is only sending 50 bytes while client is expecting 100 and server is also waiting for client's reply (i.e. socket close connection has not been initiated by server in which recv will return)    </p></li>
  </ul>
  
  <p>I am interested on Linux / Solaris platform. I don't have the development environment to check it out myself.</p>