title: C Client/Server Communicating with fprintf?
body: <p>How would you make a server be able to send messages to a client using printf or fprintf instead of using the write system call? </p>
  
  <p>I already have my server made and working, sending messages via write, but I would rather use fprintf. </p>
  
  <p>For example this didn't work:</p>
  
  <pre><code>newsockfd = accept(sockfd,(struct sockaddr *) &amp;cli_addr, &amp;clilen);
  FILE *fp = fdopen(newsockfd, "w");
  fprintf(fp, "test"); 
  fflush(fp);
  </code></pre>
  
  <p>I know have a new problem. When I have just the above code it works and I can see it in my browser, however if I add read(newsockfd,buffer,255) after then I on longer see the message posted in my client. </p>