title: How to read all of Inputstream in Server Socket JAVA
body: <p>I am using Java.net at one of my project.
  and I wrote a App Server that gets inputStream from a client.
  But some times my (buffered)InputStream can not get all of OutputStream that client sent to my server.
  How can I write a wait or some thing like that, that my InputStream gets all of the OutputStream of client?</p>
  
  <p>(My InputStream is not a String)</p>
  
  <pre><code>private Socket clientSocket;
  private ServerSocket server;
  private BufferedOutputStream outputS;
  private BufferedInputStream inputS;
  private InputStream inBS;
  private OutputStream outBS;
  
  server = new ServerSocket(30501, 100);
  clientSocket = server.accept();
  
  public void getStreamFromClient()  {
      try {
          outBS = clientSocket.getOutputStream();
          outputS = new BufferedOutputStream( outBS);
          outputS.flush();
  
          inBS = clientSocket.getInputStream();
          inputS = new BufferedInputStream( inBS );
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Thanks.</p>