Menu

key? in telnet session.

2025-03-30
2025-04-21
  • Frans-Pieter Vonck

    Via an wifi-serial bridge (esp-link) I can start a telnet session and communicate with flashforth.
    I tried out blinky, toggle a led until a key is hit, I noticed that key? is consuming the return that is typed in after typing a word. Therefore the loop is only done once. Do i need to write another word for reading keys or is there a setting in telnet in linux that i can adjust? Grts, F.P.

     
  • Mikael Nordman

    Mikael Nordman - 2025-03-31

    FF recognizes the following end of line sequences
    * CR (Mac)
    * CR LF (Windows)
    * LF (Linux)
    The problem is the CRLF. ACCEPT interprets that a line is complete by CR and then discards the the following LF in the next call to ACCEPT. But if the next word that call KEY?/KEY is not ACCEPT, then KEY? and KEY will receive the LF as an extra character.

    You could just check if there is an extra character in the input before you start the blinky loop.

     
  • Frans-Pieter Vonck

    I have found a solution with socat (linux)
    socat -,raw,echo=0 TCP4:[address]:23

    That works. The only disadvantage is that closing the connection with Ctrl-D does not work in raw mode. ' Pkill socat' will solve that, but for that you need to open another terminal window.
    Another interesting challenge is to send files to the telnet server.
    I use the following procedure
    First define a function that slows down the reading of the text-file
    function slowcat() { while read; do sleep .20; echo "$REPLY"; done; }

    And then:
    cat [file.txt] | slowcat | nc [adress] 23

    This works with one caveat.
    Now are inline comments not recognized. I have tried several eol characters but no success. The makeshift solution is the give each comment phrase its own line.

    Besides these hickups I enjoy programming my flashforth arduino over the air with esp-link (wifi-uart bridge). A great feature of esp-link is the possibility to reboot the microcontoller with a GET request. That is great for experimenting with a remote forth system.

     

    Last edit: Frans-Pieter Vonck 2025-04-21

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.