title: User input from the client isn't going to the server
body: <p>In my client server application, client is supposed to input some command in a special format given (i.e., <code>vp(size, transport, days)</code>). Now if the client input wrong command in wrong formate, it is able to ask the user to input again (that's how I have set the logic in <code>else</code>). But after that, once the client input again,the program can't read and send the command. Actually nothing happens when the user input the request again.</p>
  
  <p><em>Please ask me to post the server side code if it's neede.</em></p>
  
  <p>Client:</p>
  
  <pre><code>public class TCPClient {
  
      static boolean run = true;
  
      public static void main(String args[]) {
          Socket client = null;
          int portnum = 8080;
          if (args.length &gt;= 1) {
              portnum = Integer.parseInt(args[0]);
          }
          new TCPClient(client, portnum);
      }
  
      public TCPClient(Socket client, int portNumber) {
          try {
              String answer = "";
              String command = "";
  
              // Creating client socket
              client = new Socket(InetAddress.getLocalHost(), portNumber);
              System.out.println("Client socket is made" + client);
  
              // Creating output stream
              OutputStream clientOut = client.getOutputStream();
              PrintWriter pw = new PrintWriter(clientOut, true);
  
              InputStream clientIn = client.getInputStream();
              BufferedReader br = new BufferedReader(new InputStreamReader(clientIn));
  
              BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
  
              while (run) {
  
  
  
                  System.out.println("Mention the Family Size (FZ), Means of Travel (MT), Number of Days (ND) in the given format below: "
                          + "vp(FZ,MT,ND)");//example: vp(2,air,30,)
  
                  command = userInput.readLine().trim(); //sending a request to the server
                  pw.println(command);
  
                  answer = br.readLine();     //reading the response from the server
  
                  System.out.println("Server replied: " + answer);
   if (answer != null &amp;&amp; answer.startsWith("Price")) {
                      System.out.println("Write your Name (N), ID number (ID) and Phone Number (PN) in the format: "
                              + "PersonDetalis(N,ID,PN)");//
  
                  } else {
  
                      System.out.println("Program initializing.. Try again!");
                      new TCPClient(client, portNumber);
  
                  }
  
                  command = userInput.readLine().trim();//sending request
                  pw.println(command);
  
                  System.out.println("Server replied: " + br.readLine());
                  run = false;
              }
              pw.close();
              br.close();
              client.close();
          } catch (IOException ie) {
  
              System.out.println("I/O error. Run the program again ");
          }
  
   }
  
      }
  </code></pre>