0
Hello I am "trying" to make a server socket until there I got but I am not able to make the communication between the servers.
But the weirdest thing is the following check out the print below
But what is happening instead the message come out in just one sentence is "flooding" the console with the letters. The message that should be sent to the server would be "Player" but the one that is returning "J" "O" "G" "A" "D" "O" "R"
I’m just starting this whole socket thing. The way I sent the message:
public void socketSendMensagem(String mensagem) {
try {
PrintStream saida = new PrintStream(cliente.getOutputStream());
saida.println(mensagem);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
What I had to do to get the full message:
while(true) {
System.out.println((char) cliente.getInputStream().read());
}
There is another method
Relate the item
better than this?
Please provide a [mcve] so that we can execute the code and help solve the problem.
– user28595