Force telnet client into character mode

后端 未结 3 474
情深已故
情深已故 2020-11-29 08:52

I have an application where I accept a socket connection from a telnet client and put up a simple, keyboard driven character GUI.

The telnet client, at least on Linu

相关标签:
3条回答
  • 2020-11-29 09:13

    Interesting. I had more luck sending

    IAC WILL ECHO IAC WILL SUPPRESS_GO_AHEAD IAC WONT LINEMODE
    255  251    1 255  251                 3 255  252       34
    

    The IAC WONT LINEMODE seems to be redundant: my telnet client seems to get to the right state without it, but I left it in for completeness.

    0 讨论(0)
  • 2020-11-29 09:14

    For what it's worth, solved it myself.

    // IAC WONT LINEMODE IAC WILL ECHO
    
    write(s,"\377\375\042\377\373\001",6);
    

    gets the remote (at least telnet from an Xterm on a Linux box) into the right state.

    0 讨论(0)
  • 2020-11-29 09:15

    Kevin's solution works great: write(s,"\377\375\042\377\373\001",6);

    Although the comment is slightly wrong. It should say "DO LINEMODE", not "WONT LINEMODE", ie: // IAC DO LINEMODE IAC WILL ECHO

    (Source: rfc854)

    0 讨论(0)
提交回复
热议问题