how do I send a line through the server in a loop?
<pre><code>Socket s1=new Socket("localhost",3001);
System.out.println("Client process");
byte b[]=new byte[150];
int n=4;
BufferedReader BR=new BufferedReader(new InputStreamReader(s1.getInputStream()));
String str=new String();
while((str=BR.readLine())!=null)
{
    System.out.println();
    System.out.println(str);
}
s1.close();
</code></pre>

<p>In the above code I'm trying to read a line from server and print that line on client machine.But the client couldn't read a line until the server is finished writing all lines and closed.Please help me how to read a line from server at a time.</p>
