Is there a working Telnet library out there

I am looking for a telnet library. I tried this one: https://github.com/fearless40/spark-telnet-server-lib.git27

But it seems outdated and doesn’t compile. I removed the commandparser from it, to get it compiled. But it does nothing.
The callback function is never executed and the telnet client gets a timeout.

BTW: is it normal that I cannot ping a core which is connected to the cloud?

The last patch from TI ("deep update") removed the ability for the TI CC3000 to autonomously answer ping requests, so yes that is quite normal.

Use my copy it needed a few pre-processor changes to be working. Which if I ever fix my build environment I will fix properly. But that does compile and work with the examples it provides.

1 Like

I just tried it. But it’s the same as the original. If I connect via telnet (Putty) I can enter a few caracters which not seem to trigger the processData function. After a few seconds, it disconnects (closing putty);

Hmm that is odd. Are you sure you are connecting to the right IP and port for your spark core? (starting simple here)

Yes, I am sure. I build the simple TCP Server example and it works, echoing back all characters I enter. But the telnet example does not work.
BTW: your version does not compile from start also, because it uses network class instead of the new WiFi class in the example code. So maybe there is some more outdated stuff in it.

Thorsten

It seems I a had to be not sure. I never saw the 8000 in the Telnet initiator. So I tried port 23 since this ist the normal telnet port. On port 8000 it responded normally. Sorry for my dumbness.

But I found some missbehaviour: I tried to check what happens if I type more than the buffer can hold. The answer is bad: it crashes. Several red flashes and the a reboot.
I tried to find the error handling routine, but all that class syntax is too complicated for me as an old fashioned C programmer. :frowning:

The next problem is how to adopt the telnet server so that I can use the input routine also on serial port. I mean, I want to use both, serial and the telnet server to enter commands. But I don’t know how to build a “stream” class for the serial port which fetches character by character, allowing some simple line editing (backspace) and then supply it to the command parser as an output stream.

To be honest that is a bit above my knowledge but i could look into hacking it in at somepoint ^^
Also i could have sworn it had an error handler for that. Ill check into that later as well.

I want to change the callback routine of the Telnet library to leave out the flags. So I have to write the welcome message and prompt directly in the telnet library itself. But I cannot print something to the client from within the
Server::poll function. My print command simply crashes the telnet server. Any idea why? I only added the print(“Hello”) statement into the below code.

//	If the state is NoConnection then try to see if we are connected
//		if we are connected then do welcome message and telnet negotiation
if( state == InitalizedNoConnection && mClient.connected() ) {
	Serial1.println("Client connected");
	state = FirstConnectionToClient;

	// Start negotiation of telnet parameters
	print(TelnetHandler::OnFirstConnection());

	// This is new: I want to print the welcome message without the callback routine
	println("Hello");
	// This is the old way via callback routine: Do welcome message
	if(mProcessedCallback)
		mProcessedCallback(this, NULL, CBF_WelcomeMsg);
	state = ActiveConnection;

	// mClient.flush();

	// Exit to prevent further processing
	return true;

}

BTW: why is the telnet output to the client so slow. It’s like an old 9600Bd modem from older days.

To be completely honest I have not figured out how to send stuff back to the client either unless its inside the command parser then its;

TelnetServer->Print(“msg”);

Tho I have a feeling if you pass that object to a method and call it the same way it will work. But i have not tried as of yet