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
The BufferedReader will keep on reading the input until it reaches the end (end of file or stream or source etc). In this case, the 'end' is the closing of the socket. So as long as the Socket connection is open, your loop will run, and the BufferedReader will just wait for more input, looping each time a '\n' is reached.