Reputation: 77
I am writing a server-client application.
The problem is, that in the server the PrintWriter
doesn't flush after some point, just after I close the print writer. But if I close the print writer, it closes the socket as well, however I need to use it later.
How can I solve this?
pw = new PrintStream(socket.getOutputStream());
pw.println("igyulibigyuli");
pw.flush();
It doesn't flush, just if I close the printwriter after the flush.(Or if I close the program!)
Upvotes: 0
Views: 1667
Reputation: 77
The problam was that the socket was busy reading(in a while loop, till it get not null).
Upvotes: 0