title: Why JAVA BufferedReader can't receive String from python client after sending String using PrintWriter?
body: <p>I write codes that Python client sends String and JAVA server receives it and then JAVA server sends String and Python client receives it.</p>
  
  <p>But I can't add code line that Python client sends String and JAVA server receives it again.</p>
  
  <p>I use BufferedReader to get input stream and read it using readLine and utf-8. And I use PrintWriter to get output stream and send string but when I use BufferedReader after PrintWriter, I can't get String from python client.</p>
  
  <p>Why JAVA BufferedReader can't receive String from python client after sending String using PrintWriter?</p>
  
  <p>Belows are my codes.</p>
  
  <p>JAVA server code:</p>
  
  <pre><code>package solution;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.net.ServerSocket;
  import java.net.Socket;
  
  public class sol {
  
      public static void main(String[] args) {
          try {
              ServerSocket server = new ServerSocket(8000);
              Socket socket = server.accept();
  
              BufferedReader br = new BufferedReader(
                      new InputStreamReader(
                              socket.getInputStream(), "UTF-8"
                      )
              );
  
              String a, b, c, d;
  
              a = br.readLine();
              b = br.readLine();
              c = br.readLine();
  
              System.out.println(a);
              System.out.println(b);
              System.out.println(c);
  
              PrintWriter pw = new PrintWriter(socket.getOutputStream(), true);
  
              pw.print("Hello");
  
              d = br.readLine(); // I can't receive? read? String from Python client..
  
              System.out.println(d);
  
              pw.close();
              br.close();
              socket.close();
              server.close();
          } catch(IOException e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  
  <p>Python client code:</p>
  
  <pre><code>from socket import *
  from select import select
  
  HOST = '' // sorry it is my ip
  PORT = 8000
  
  client = socket()
  
  try:
      client.connect((HOST,PORT))
  
      client.sendall(bytes("A\nB\nC\n", encoding = 'utf8'))
  
      data = client.recv(1024)
      data = data.decode()
      print(data)
  
      client.send(bytes("D\n", encoding = 'utf8'))
  
      client.close()
  except Exception as e:
      print(e)
  </code></pre>