title: send file with socket
body: <p>What is wrong in this code (C - Linux)?</p>
  
  <p>I want to receive a file from a server and as soon as I have a byte I send immediately this bytes. But It doesn't work. It's important.</p>
  
  <pre><code>int Recv_File(int server,int client,char *buffer_ricezione,size_t dimensione_file){
  
      ssize_t nwritten,nread;
      size_t n;
      char c;
  
      for (n=1; n&lt;dimensione_file; n++) {
          nread = recv(server,&amp;c,1,0);
          if (nread == 1) {
              nwritten = send(client,&amp;c,1,0);
          }else{
              return -1; // chiudo connessione con il client
          }
      }
      return 1;
  }
  </code></pre>
  
  <p>Thanks</p>