PrintWriter or any other output stream in Java do not know "\r\n"

Call flush() after you write from client to server, like so:

out.print(textToServer + "\r\n" );  // send to server
out.flush(); // here, it should get you going.

flush(): Flushes output stream and forces any buffered output bytes to be written out.


On top of VishalD's answer, there's no need to worry about using println() or sending with \r\n because readline() looks for \n anyway. From the API:

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.