title: Java Sockets: Send multiple lines and receive multiple lines
body: <p>I am sending multiple lines to a <code>ServerSocket</code> using a <code>PrintWriter</code>.</p>
  
  <pre><code>PrintWriter printWriter = ...
  printWriter.write("1");
  printWriter.write("2");
  printWriter.write("3");
  </code></pre>
  
  <p>Then I am trying to receive it with a <code>BufferedReader</code></p>
  
  <pre><code>ServerSocket serverSocket = ...
  Socket socket = serverSocket.accept();
  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  
  System.out.println(bufferedReader.readLine());
  </code></pre>
  
  <p>I am of course closing all the resources, I wrote this code only to visualize the problem.
  That prints <code>123</code> but it is supposed to print <code>1</code>. How can I fix that? </p>