I'm using the followin code in the server of a chat application , where I'm using a seprate thread for each client . 
**Code:**

```
public void run()
{
String msg;
InputStreamReader isReader = new InputStreamReader(sock.getInputStream())
BufferReader r= new BufferedReader(isReader);
int i=0,j=0;
System.out.print("entered run again"+i++);
try{
             while((msg=r.readLine())!=null)
    {
        System.out.println("readed"+msg );

            spreadMsg(msg);

    }

    }catch(Exception e){e.printStackTrace();}

 }

}   

```

why the while loop **"while((msg=r.readLine())!=null)"** is beahaving as infinite loop and why it's not returning after it has read the only line I've entered.