When receiving data using readLine(), even though I put a \"\\n\" at the end of the message using the .flush when sending the message, the while loop that reads my message s
I tried a lot of solutions but the only one I found which wasn't blocking execution was:
BufferedReader inStream = new BufferedReader(new
InputStreamReader(yourInputStream));
String line;
while(inStream.ready() && (line = inStream.readLine()) != null) {
System.out.println(line);
}
The inStream.ready()
returns false if the next readLine()
call will block the execution.