title: If inside while
body: <p><strong>PROBLEM SOLVED:</strong> I forgot to flush the <code>PrintWriter</code> in client.</p>
  
  <p>I'm having an issue with this code. The output is 1, 2, 3, 4, 5, 5.5 but it won't reach 6 or 5.75 and I can't figure out what's wrong. It's a client/server application using sockets.</p>
  
  <p>Client:</p>
  
  <pre><code>System.out.println("1");
  socket = new Socket("localhost", 1035);
  System.out.println("2");
  br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  System.out.println("3");
  pw = new PrintWriter(socket.getOutputStream());
  System.out.println("4");
  
  pw.println("hello");
  String message = null;
  System.out.println("5");
  boolean done = false;
  
  while(!done) {
      System.out.println("5.5");
      if((message = br.readLine()) != null) {
          System.out.println("6");
          cardname.setText(message);
          done = true;
      }
      System.out.println("5.75");
  }
  System.out.println("7");
  </code></pre>
  
  <p>Server:</p>
  
  <pre><code>        @Override
          public void run() {
              String message = null;
              boolean done = false;
              try {
                  System.out.println("5.25");
                  while(!done) {
                      System.out.println("5.5");
                      if((message = br.readLine()) != null) {
                          System.out.println("6");
                          String resp = handleRequest(message, sock.getInetAddress());
                          pw.println(resp);
                          pw.flush();
                          System.out.println("7");
                      }
                      System.out.println("5.75");
                  }
                  connDec();
              } catch(Exception ex) {ex.printStackTrace();}
          }
  </code></pre>