title: Recv call get empty data
body: <p>I'm learning to work with sockets in c.
  Here is my code:</p>
  
  <pre><code>void work_with_client(int client_sock){
      char buff[10] = {0};
  
      while(1){
              kv_log_message("\tWork with client\n");
              int is_received = recv(client_sock, buff, 10, 0); 
              if(is_received &lt; 0){ 
                      perror("Received failed");
              } else {
                      printf("RESPONSE: %s\n", buff);
              }   
              printf("RESPONSE %d\n", is_received);
  
              sleep(1);
      }   
  }
  </code></pre>
  
  <p>When I connect through telnet to this server and immediately disconnect, server print this lines:</p>
  
  <pre><code>    Work with client
  RESPONSE: 
  RESPONSE 10
      Work with client
  RESPONSE: 
  RESPONSE 10
      Work with client
  RESPONSE: 
  RESPONSE 10
      Work with client
  RESPONSE: 
  RESPONSE 10
      Work with client
  RESPONSE: 
  RESPONSE 1
      Work with client
  RESPONSE: 
  RESPONSE 0
      Work with client
  </code></pre>
  
  <p>And I don't get why first 4 <code>recv</code> calls get full size of buffer data (I don't write anything to the socket from client perspective).
  Any suggestions?
  P.S. Run on Mac OS X Yosemite</p>
  
  <p><strong>UPDATE:</strong> i test my program on Linux, and recv call always return 0 in my case, so probably the problem in telnet on Mac OS X </p>