I am implementing a server client application in java. Situation is that client sends some message to server and server may or may not respond(send back some message).
Have a look at this
is = new DataInputStream(client.getInputStream());
Now i am using is.readUTF();
method to get the message back.
Problem is that readUTF is a blocking call and it stops the program right there to receive a message. As i said that server may or may not respond and i need a way to stop the readUTF method from stopping the program(checking if there is a message or not) and keep on continue if there is no message received.