![]() |
Forum Index : Microcontroller and PC projects : Telnet and the MM
Author | Message | ||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
Hello all! Question for the tome of TBS. I have an idea that would require the MM to connect to a telnet server via wireless. Receive - process - send. Has anyone done this? Is it even remotely feasible without writing a telnet client in Basic? Looking through past posts it appears that telnet is sort of available as an option on the wireless boards but no one has really commented on actually using/trying it. Is only an idea at this point - whether it is a good idea or not remains to be seen. Gary tends to run into the 90% bad idea range upon research usually. ![]() Thanks for any insight you may be able to provide! Gary |
||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
...and then the ESP8266 comes in to view! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
True telnet requires a lot of initial handshaking where each end works out what the other end is capable of. It is doable but the technical term is "a real bugger" Fortunately, in most cases if your end plays dumb, the other end works that out easily enough and things carry on regardless. The worst that happens is a few strange bytes get received at the start of communications. Jim VK7JH MMedit |
||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
Thanks Jim. Have been doing some raw testing with the data I have to work with and do see some garbage that appears could be filtered easy enough in code. It also appears to disappear with time as you suggest. I knew there was a bit of conversation to work out the bits, just didn't know if this was handled closer to the stack or after the wheels got spinning. Telnet. It's 2018. Who uses telnet. This particular project is so useless and waste of time and energy that I may go ahead and attempt it. Hoping that I may learn something useful. Or at best learn what not to do! 73 de N8MDL |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
LMFAO!!!! ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
what exactly are you wanting to do? telnet is primarily intended for transferring files, but it can (and often is it would seems) also used to establish a simple interactive terminal session. which one are you after achieving? as far as an interactive terminal session, there is both Teraterm and GFXterm that can achieve this. while the wireless side, as you've noticed, can be done with a EPS8266. alternatively, there is the project discussed in this thread: http://www.thebackshed.com/forum/forum_posts.asp?TID=9871&KW=esp8266 this should give you a terminal session in a browser window. cheers, rob :-) |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Not garbage. IAC capabilities - the two ends try to work out the capabilities of each other - remember telnet is a console protocol so the server needs to know how smart (or not) the console is. You should really reply to them correctly rather than just ignore them as it will delay the initial setup while timeouts happen... and could even make some servers abort the connection if they don't get a reply. Here is a relevant RFC (although not the most current I think) for telnet - read the bit under GENERAL CONSIDERATIONS, specifically point 2 and then the bottom of page 3 & top of page 4. https://tools.ietf.org/html/rfc854 What the server is asking the terminal (WILLs & DOs) can simply be replied with WON'Ts and DON'Ts to give you a simple dumb/raw protocol for simple exchange. Telnet uses char 255 (&hFF) as what it calls "Interpret As Command" (IAC) which means "the next character I send is not for displaying" and this can be done at anytime - so it is not entirely dumb. Here is a really nice discussion of telnet that should give you absolutely everything you need (although the colour scheme is a bit sicky) - look at the "Option Negotiation" section. http://mars.netanya.ac.il/~unesco/cdrom/booklet/HTML/NETWORKING/node300.html it's all a thrilling read ![]() |
||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
A thrilling read indeed! Perhaps a bit of detail as to the mission at hand. Have told this story many times over the years and it has generally been met with blank stares - I believe this group may be....unique?....enough to get it. ![]() Nostalgia mode on. Back in the 70's during the high school years, the school districts in our area had a county intermediate school district above them that basically supplied resources to the local districts. One of the resources was an HP2000 mainframe with 32 dial up modems attached. They also had a PDP 11/34 and 11/70 but memory says those were just for COBOL and RPG. The high schools basically used teletypes, DECwriters, etc to dial in and write code for a math class (?) in BASIC. There were a few students that took it a bit further and had terminals (Hazeltine for me) at their houses and were able to use this thing from home. Very cool stuff at the time. Not cheap either though - 300 baud modems were expensive! A couple of students in another district who were enthralled in game playing, science, programming, Star Trek, etc. developed a 3 dimensional real-time multi-player game based on the universe of Star Trek. Again, this was a text only world so text was all that you had to work with. Can still remember the sound of the DECwriter when an update came. It was/is quite challenging to play this thing as everything is moving in 3 dimensions in real-time trying to shoot and hit things using only your head as the calculator. Years go by. One of the group decided he was learning C and this would be a great project to learn with and so he did. 40 years later this game sits on a LINUX box with telnet connections as opposed to serial. There have been clients written to add some graphics and sound - most recently a web client was written that is really remarkable. This is where the telnet came in. So, with other conversations of gaming going on in the forum it sparked a "what if I could write a client on the MM? Read the data - do some graphics - create a few client side math trickery commands - send it back out." kind of thing. In the spirit of Trek - maybe a bit of M5? Of course this could be considered cheating. But it could also be considered changing the conditions of the test. So I will go with that one. This is why I suggested the idea was so totally useless and without value that I will likely give it a go.... Nostalgia off. What I do not need is an actual telnet client - really the ability to receive and digest the raw data that is supplied from the telnet server. Have been testing with Putty in RAW mode and can see all of the data - plus the "garbage" as I called the negotiation of capabilities. Really do appreciate the advice and the tap into the tome here. What all of you do and add to this board is truly amazing stuff and really a joy to read and learn! Gary |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Hazeltine 2000 terminal - weighed a ton! oh the memories. It was attached to a Cromemco Z-2D... I was a callow youth just out of my teens and it was a hell of an adventure... I think probably the best working days of my life for interest sake. It all got a bit, well... IT after that. Nothing like interfacing to the real world with a micro. OK, telnet on MM All entirely do-able. If you use an ESPxxx (wifi) or a wired module like USR-TCP232, they all present a serial interface which is child's play to hook up to the MM. Then you simply talk AT commands to configure and once the connection is formed, anything in/out will appear at the relevant end. For telnet, form your connection and then wait for the IACs to appear. Reply in the negative to each one (maybe 3 or 4) and you will get a very dumb link. I used a telnet link years ago with some of my code and managed to find the VB6 that dealt with the IACS (I am such a sad case). Might give you some insight - this definitely worked with no problems talking to Solaris 2.7... Winsock1.PeekData a, vbString If Left(a, 1) = Chr(255) Then Winsock1.GetData a, vbString, 3 Winsock1.SendData Chr(255) Winsock1.SendData Chr(252) Winsock1.SendData Mid(a, 3, 1) End If In this case the server accepted WONT (252) as a default for any question but ymmv simply, it spied on the inbound data and if a char 255 came along, it burned the three bytes starting with the 255 and replied "no" to what the server queried (third of the three bytes) The characters you can expect are: 255 IAC 254 DONT 253 DO(?) 252 WONT 251 WILL Found this example of a handshake being torn-down, first two are the server asking "do you do this?" the next two are the server saying "I offer you this" ... just play grumpy and reply "no and shut up" and the server will get the hint ![]() ... for every WILL, respond DONT. For every DO, respond WONT. In your case, you've received: 255 253 1 IAC DO ECHO 255 253 31 IAC DO NAWS 255 251 1 IAC WILL ECHO 255 251 3 IAC WILL SUPPRESS-GO-AHEAD So you should respond: 255 252 1 IAC WONT ECHO 255 252 31 IAC WONT NAWS 255 254 1 IAC DONT ECHO 255 254 3 IAC DONT SUPPRESS-GO-AHEAD Note that you don't have to know what 1, 3, or 31 actually mean. That's the beauty. You can refuse those options without even knowing their definition. You'll just default to the network virtual terminal. here good luck! Once you have your hardware sorted, the rest is just code. |
||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
Thank you Captain. Yes they were heavy. I did sell it and picked up a TRS80 Model 1 with expansion interface. Had to have that for the RS232 board and a disk drive. Was sure it was doable. Had always intended to do something in VB - just never got around to it. With the advent of the MM there are now so many possibilities. Supporting all the maths with IO and display options. Agreed on the memories from those times. Everything seemed possible. Now...well, as you say, it is IT. If life will allow me to keep focus on this I will be sure to share the nonsense with everyone here. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
I look forward to it. From my experience with networking at such a low level (in any language), I find the nebulous nature the hardest thing to deal with... If you open a file on disk, you can just read bytes machine-gun style. With networking you have to be mindful that someone could pull the cable out and you'll never get the next byte, or that someone is typing and the characters might not come in time. Lets say you have your hardware all working and you get an IAC and a DO but then the actual function byte (say, 1 = ECHO) never turns up... you have to have timeouts in any networking code and ways to recover. My advice is to concentrate on developing a single, bomb-proof function to get characters that has a timeout ticking all the time. Then you can use this to build up your data strings. I have wasted a lot of time in the past trying to get strings and be clever only to be dealing with errors in multiple places ![]() ![]() I tend to grab characters one at a time - it doesn't come across as efficient but the MM is easy fast enough and it gives very fine control over what happens with what is received. Looking at my VB example above, I was asking for a kicking - there was no checking for data-availablity. Fortunately a fast network and good servers stopped me having to work on that ![]() Serial buffers: Network speeds with the amount of data they can provide in short time can easily swamp the serial link if you aren't careful - have a big buffer on the serial port where your ethernet connection comes in. Find what works then add 2K and make sure you service it asap. all the best |
||||
n8mdl Newbie ![]() Joined: 11/08/2011 Location: United StatesPosts: 11 |
Understood. Reality is the game was written to be played on a teletype (110 baud) if necessary so the amount of data flowing is relatively lite weight. Mainly positions xyz and course/bearing. Maybe every few seconds if that. Back in the day rolled/fanfold paper was not always the easiest thing to come by. CRT was a true luxury. The bottleneck in the data processing is the human in this case. If the server were to stream info there is no way you could keep up manually. This human has a hard time with every few seconds to be honest. I am very much looking forward to the learning aspect of the exercise in all reality. Hopefully my brains coding logic is still partially intact. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
like riding a bike... just need to knock the rust off that's all ![]() |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Hi Gary, Welcome to the forum. If you could get access to the original BASIC program, it might be an interesting/challenging project to port to the MM+ and make use of the graphics capabilities? Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |