I've got TCP client app which successfully negotiates connection to server and receives buffered output, but what I need to know is how to read server responses without waiting to buffer to fill out or server to end connection.
In this loop:
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
...some code here...
}
mine app just freezes.
How to read just one line or empty string if buffer is empty and continuing to execute a program?
Is it possible to timeout this reading, to give server some time to respond?