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.