I write socket client:
clientSocket = new Socket("192.168.1.102", 15780);
outToServer = new DataOutputStream(clientSocket.getOutputStream());
All works. But I wont to send to server UTF-8 format messages and do so:
outToServer.writeBytes("msg#");//server tag
outToServer.writeUTF("hello");
//outToServer.writeUTF(str); //or another string
outToServer.writeBytes("\n");
outToServer.flush();
Messages become such:
Tell me please why? How correctly send UTF messages?