节点JS telnet服务器奇怪的输入和奇怪的输出

Node JS telnet server weird input and strange output

本文关键字:输出 输入 JS 节点 telnet 服务器      更新时间:2023-09-26

嘿,伙计们,我在运行这台服务器。它在我的mac上运行得很好。但是,当我通过windows计算机上的telnet连接到运行在mac上的服务器时,所有文本都是倾斜的,输入都是单个字符。我们将不胜感激。

提前谢谢。

看起来您的telnet客户端默认情况下不以行模式运行。当你尝试键入密码时,它会读取第一个字符,服务器会将其与预期密码进行比较:

$ telnet localhost 8000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Password:RPassword rejected:RConnection closed by foreign host.

尝试使用netcathttp://en.wikipedia.org/wiki/Netcat.它是行缓冲的:

$ nc localhost 8000
Password:Rushabh
[me]: has joined the chattest
[me]:test
second test
[me]:second test

如果你真的想使用telnet,你可以改变你的服务器来处理逐个字符的输入,或者尝试转义(^])并设置mode line(由于某种原因,我没有成功。我使用的是Cygwin项目分发的telnet客户端。)