title: Android bufferedReader.readLine for continuously listening
body: <p>I'm trying to write a demo-app that connects to a server and then simply keeps listening for randomly timed input from the server. Discovering the and connecting to the server works fine, now I start a new thread, so I don't block the ui. Now, in my thread, I need to continuously listen and react if there's incoming data. According to what I've read so far, it should be done like that: </p>
  
  <pre><code>  while (connected) {
        while ((line = bufferedReader.readLine()) != null) {
            // do something with line and contact the ui
        }
    }
  </code></pre>
  
  <p>What I don't understand: readLine() obviously can only read a line if there's incoming data from the server. So, shouldn't the loop break once the server has stopped sending, meaning  when there's nothing sent?</p>
  
  <p>Thanx for any thought,
  Marcus</p>