← Back to context

Comment by wumms

5 days ago

If I telnet into an ESP32 via Termux, it doesn’t recognize \n. I haven’t found a solution yet. It works fine with other Linux consoles.

    void handleTelnet() {
      ...
      if (telnetClient && telnetClient.connected() && telnetClient.available()) {
        String cmd = telnetClient.readStringUntil('\n'); cmd.trim();
        if (cmd == "status") {
        ...

EDIT: Thanks @yjftsjthsd-h and @detaro for your suggestions! I tried Telnet via tmux - it worked. Then I tried telnet directly, and it suddenly worked too. Turns out Arduino’s Telnet implementation is single-user only, and my dev machine’s reconnect loop kept the connection open; the working login just fooled me.

I don't have one set up to test, but dumb suggestion: What if you run it inside tmux on termux? Just thinking that tmux is essentially a second terminal emulator that might do better.

Telnet often uses "\r\0" instead, but it also can be configured with most clients.