JAndrassy/TelnetStream

missing "connected()"

mrWheel opened this issue · 3 comments

It would really be nice if there was a
TelnetSerial.connected()
function available

As a "work-around" I have moved

bool disconnected()

from private to public in the .h file.

The log() function of the example I added at the top:

  if (TelnetStream.disconnected()) {
    Console = &Serial;
  } else {
    Console = &TelnetStream;
  }

Now everything send to log() will be printed to the telnet connection, if available, otherwise it will be printed on the console (Serial).

why not log to both?

Well, for a start, I don't know if you can print something to the TelnetSerial if it is not there...
Will try that.
Still, a "connected()" bool would be nice ;-)

you can print to Serial, if it is not connected and you can print to TelnetStream if it is not connected.