Telnetstream library- detecting when telnet connected

Hi,

I am experimenting with the wonderful TelnetStream library and I was wondering if there is a way to detect when a client connects. Is there a flag raised ?

In addition after a connection is terminated via TelnetStream.stop(), does a TelnetStream.begin() needs to be issued again to accept new clients?

no. the TelnetStream library uses server.available() which only returns a client with data currently available. It registers all the connected clients and even allows to write to them at once.

This is demonstrated by my PagerServer example in Ethernet library. In contrast the AdvancedChatServer example shows the accept() method and can welcome clients before they send something. But it has to manage the list of clients.

no. the TelnetStream library uses server.available() which only returns a client with data currently available. It registers all the connected clients and even allows to write to them at once.

does this refer to my first question, regarding the connection flag?

yes

yes

Something like this ?

void exitTelnet(){
 
 TelnetStream.println("bye bye");
 delay(2000);
 TelnetStream.flush();
 TelnetStream.stop();
 TelnetStream.begin();
 
}

stop() stops the current client

yes i know that.
My question was that if after stop() I then need to do a begin() before a new client can be accepted.

no. begin starts the server.

yes I see that it is confusing

Ok, thats clear now. begin() needs to be issued only once.

My other question was if there is any indication of the number if any clients connected?

no.