Detecting a null value from socket getOutputStream
843790Feb 26 2007 — edited Feb 27 2007In this following line of codes
br = new BufferedReader(new InputStreamReader(soc.getInputStream()));
String message = br.readLine();
which i am using it with an JApplet whenever the client clicks on the recieve button this code gets executed,which reads the message from the server.But if the sever has not sent any message and if the client clicks on the recieve button control reaches the br.readLine(),and the program waits until it gets a message from the server,and if i want to click on any other button or stop the reading process nothing happens,it waits like in an endless loop.
I tried the following codes
if(br.ready())
{
message = br.readLine();
}
else
{
System.out.println("No message");
}
or
if(soc.getOutputStream().equals(""))
{
System.out.println("No message");
}
else
{
message = br.readLine();
}
but none of the code is working.
please help me
thank u