Java Socket why server can not reply client

you should add "\r\n" at the end of the String which write into stream.

example:

client :

    string = "end";
    out.write(string + "\r\n");
    out.flush();

server :

    out.write("to end" + "\r\n");
    out.flush();
    out.close();
    System.out.println("end");
                // break;

Leave a Comment