title: when sending a message from the buffer is the buffer automatically cleared?
body: <p>I'm trying to write a code for a socket where I first read the <code>stdin</code> and send  to a socket then read from said socket to send to <code>stdout</code> and so far I have something that looks more or less like this (before you attack me I also don't know why I have to do this) :</p>
  <pre><code>void read_write(int socket_descriptor_file){
      int n = 1;
      char buffer_in[1024];
  
  
      while(n&gt;0){
          n = fread(&amp;buffer_in,sizeof(buffer_in),1, stdin);
          if(n==0) break;
  
          ssize_t sent_status = send(socket_description_file, buffer_in, sizeof(buffer_in), 0);
  
          if(sent_status == -1){
              printf(&quot;nothing sent&quot;);
          }
  
          ssize_t receive_status = recv(socket_descriptor_file,buffer_in,sizeof(buffer_in), 0);
          if(receive_status == -1){
              printf(&quot;nothing received &quot;);
          }
          
          fwrite(&amp;buffer_in,sizeof (char), sizeof(buffer_in), stdout); 
          fflush(stdout);
  
          
  
  
      }
  }
  </code></pre>
  <p>I'm unsure as to if the said buffer when applying the send function will automatically clear so that I can use the buffer to store the message from the <code>recv</code> function.</p>
  <p>The objective of this code is to simulate a chat between a host 1 and a host 2. So it is necessary to send treat the message immediately.</p>
  <p>I'm also apparently supposed to use the poll function but I don't really know how to use it.</p>
  <p>I'm not really well informed in this subject so please let me know if there are any further problems with my code. I would be happy to hear them :)</p>