0

I am having an issue with the text output alignment from an Outputstream to a telnet session hosted in CMD, and I've also had same issue using Putty.

In summary I have a multi chat client project, where each client communicates with the server (localhost), and the server manages communication between clients.

The outputstream to the telnet session:

String msg = "Some message from server to client";
clientoutput.write(msg.getBytes());

The output, note it is not aligned, it appears to be randomly positioned about the window:

Outputsteam renders in what appears to be a random manner

I am using Eclipse Version: 2019-03 (4.11.0) Build id: 20190314-1200 and Windows 10 OS.

Appreciate any input on what might cause this.

Ciaran

NB I haven't included my complete code to reproduce the issue, as its a large project and I believe the question refers more to the rendering process.

dancingbush
  • 2,131
  • 5
  • 30
  • 66

1 Answers1

0

Issue was in Windows the the newline consists of CR (carriage return) + LF (line feed) characters, so we must use the System.lineSeoeartor() or \r\n.

dancingbush
  • 2,131
  • 5
  • 30
  • 66