OutputStreamWriter out = new OutputStreamWriter(sock.getOutputStream());
out.write(data);
out.flush();
sock - Socket; data - buffer of chars;
So, if I wouldn't close the "out", or "sock" then there is no data will be sent to server.
OutputStreamWriter out = new OutputStreamWriter(sock.getOutputStream());
out.write(data);
out.close();
Is fine. But why?