Hello, I'm trying to make a server socket, but I'm not able to communicate between servers.
But the strangest is the following check out the print below
Butwhatishappeninginsteadthemessagecomesoutinjustonesentenceis"flooding" the console with the letters. The message that should be sent to the server would be "Player" but what is returning "J" "O" "G" "A" "D" "O" "R"
I'm new to this socket cast. 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?