yasheena / telnetspy

Telnet Server For ESP8266: Cloning the serial port via Telnet. "Debugging over the air"
MIT License
59 stars 31 forks source link

newlines not rendered on Windows telnet #3

Closed proddy closed 5 years ago

proddy commented 5 years ago

Thanks for the great library. I'm using it in one of my projects to replace some home grown telnet logging libraries. I noticed when using Telnet on Windows the newlines are not left-justified. I think this is because you need a '\r' after a '\n'. For example using your stock example code in a Serial window it shows correctly as:

Connecting to WiFi . Connected!
Ready
IP address: 10.10.10.28

Type 'C' for WiFi connect.
Type 'D' for WiFi disconnect.
Type 'R' for WiFi reconnect.
All other chars will be echoed. Play around...

but in the telnet window:

                                Connecting to WiFi . Connected!
Ready
IP address: 10.10.10.28

Type 'C' for WiFi connect.
                          Type 'D' for WiFi disconnect.
                                                       Type 'R' for WiFi reconnect.
All other chars will be echoed. Play around...

Telnet connection established.

Works fine using telnet from Linux, like an ubuntu shell in Windows10 though.

proddy commented 5 years ago

I checked using putty with telnet and it also has the indent issue. I think somewhere in the write() when a newline is detected an additional '\r' must be added to the buffer, or something along those lines like this quick hack in write()

            addTelnetBuf(data);
            if (data == '\n') {
                addTelnetBuf('\r'); // added by proddy
            }
yasheena commented 5 years ago

There is a solution without adding code: In the putty configuration (Category:) click on "terminal" and check the line "Implicit CR in every LF".

proddy commented 5 years ago

yes, that'll work. Also using the windows telnet.exe with https://support.microsoft.com/en-nz/help/322846/telnet-client-does-not-send-crlf-when-expected

On Sun, Dec 30, 2018 at 5:34 PM Wolfgang Mattis notifications@github.com wrote:

There is a solution without adding code: In the putty configuration (Category:) click on "terminal" and check the line "Implicit CR in every LF".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yasheena/telnetspy/issues/3#issuecomment-450571942, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLHeCCyJGoXe2V0lxXPgvEakOMqUzDaks5u-OsSgaJpZM4Zkv7l .