Reading Text from a Socket
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String str;
while ((str = rd.readLine()) != null) {
process(str);
}
rd.close();
} catch (IOException e) {
}
Hi..
When i read from the socket i got the following..
First it gives me no output
Then i tried the following
if (rd != null)
{
System.out.println("there is data in bufferedreader");
}
else
{
System.out.println("there is no data in bufferedreader");
}
if(rd.ready())
{
System.out.println("Stream is ready to be read" );
}
else
{
System.out.println("Stream is not ready to be read" );
}
the o/p is--
there is data in bufferedreader
Stream is not ready to be read
can u plz tell what i do so i can read from the socket..
You can mail me at--rout.amulya@yahoo.in