Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
850 views
in Technique[技术] by (71.8m points)

char - Force telnet client into character mode

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 Linux, defaults into line-at-a-time mode, so I always have to do ^]mode char manually.

A skim of the relevant RFCs suggests that if my application simply sent the characters IAC DONT LINEMODE (37737642) as soon as the client connects, the client should be forced into character mode. However, it doesn't make any difference.

What's the simplest bit of code that would do the job? Ideally just a string to be sent. My application can absorb whatever junk the client sends back.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...