title: how to use readline without and EOF character java
body: <p>i am trying to implement a simple server application in java.</p>
  
  <p>all it does is read in a message on the tcp/ip and stores it as a string this is my code.</p>
  
  <pre><code>    try{
          in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
      } catch (IOException e) {
          System.out.println("cannot open input buffer");
          System.exit(-1);
      }
  
      clientSocket.setSoTimeout(5000);
  
      //read first bit of message
      message = in.readLine();
      System.out.println(message);
      //as message is an undefined length we need to loop and check for the springer miller 
      //end mark /Request
      while(message.contains("/Request") == false  )
      {
          try {
          message = in.readLine();
          System.out.println(message);
          }
          catch (IOException e) {
              System.out.println("cannot open input buffer");
              System.exit(-1);
          }
      }       
  
      //reply
      out.println(outputLine);
  </code></pre>
  
  <p>the problem i am having is that the message does not appear to have an EOF. it is another companies protocol i am translating into mine, thats the purpose of the program so i cannot add a EOF to the message </p>
  
  <p>the information a get if i run the program is:</p>
  
  <pre><code>POST / HTTP/1.1
  Content-Type: text/xml; charset=utf-8
  SOAPAction: http://htng.org/1.1/Listener.Wsdl#ReceiveMessageAsync
  User-Agent: Java/1.6.0_24
  Host: 192.168.0.32:8080
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Connection: keep-alive
  Content-Length: 3009
  </code></pre>
  
  <p>then it hangs when it should read the message body.</p>
  
  <p>i have never used java in my life before and do not want to write a binary socket readed to detect my own EOF.</p>
  
  <p>is there a way to read for x seconds and then return</p>
  
  <p>thank you for any help.</p>
  
  <p>P.S have already successfully built the program in C++ but need to port in to java because destined machine is unknown. </p>