title: read socket in loop
body: <p>I'm writing sockets client-server program. Client is in java and server in C. 
  I would like to read from file in server and line by line write is to client.
  fragment of client:</p>
  
  <pre><code>while(!(answer = input.readLine()).equals("end")) {
          System.out.println(answer);
      }
  </code></pre>
  
  <p>server:</p>
  
  <pre><code>char* line;
  size_t len = 0;
  ssize_t read;
  FILE* out;
  while((read = getline(&amp;line, &amp;len, out))!=-1){
      write(fd, line, read);
  }
  write(fd, "end", 3);
  </code></pre>
  
  <p>I get on output everyone lines from file, but It never go out from loop. <br>
  What I want to do?<br>
  When client connect server read lines from fine, write it to client and now client can add new lines to file (which will be reading by other clients)<br><br>
  Anyone knows how can I fix it?</p>