telnet客户及EOL治疗 [英] Telnet Clients and Their Treatment of EOL

查看:237
本文介绍了telnet客户及EOL治疗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个颇为曲折的问题,为此,我向你道歉。我写了一个Linux下C socket应用程序,对于一个简单的聊天服务器的基本框架。服务器在我的笔记本电脑上运行。客户端远程登录的那一刻,直到我写一个指定的客户端应用程序(即会更安全,希望)。有从客户端发送结束通用的网络数据更好的应用程序,我知道,但我有兴趣了解的为什么的某个事情发生一个Telnet客户端上,但不是另一个。

This is a rather convoluted question, and for that I apologize. I wrote a Linux C sockets application, a basic framework for a simplistic chat server. The server is running on my laptop. The client is Telnet at the moment until I write a designated client application (that'll be more secure, hopefully). There are better applications for sending generic network data from a client end, I know, but I got interested about why a certain thing happens on one Telnet client but not another.

第一个Telnet客户端的测试是在其他Linux笔记本电脑。它按预期工作。接下来,然而,是一个叫BBSSH黑莓应用程序,允许Telnet和SSH连接。我通过在Telnet选项去了,它也能工作。但,这并不完全。

The first Telnet client test was on another Linux laptop. It works as expected. The next, however, was a Blackberry app called BBSSH that allows Telnet and SSH connections. I went via the Telnet option, and it works too. Except, it doesn't exactly.

服务器code不平常调用来检索数据块,它被作为一个字符串处理,即一条消息。前者客户端读取,直到我按下回车键,然后将其发送字符中的一个字符串。该应用程序的BB但是,每发送一个字符,如果我一直在他们每个人后pressing进入,而我没有。显然,这是事做缓冲,有什么特定的客户端类作为用户输入一个EOL等我只是不能找出它。

The server code does the usual read call to retrieve a block of data, which gets treated as a string, i.e. a message. The former client reads until I hit enter, and then it sends one string of characters. The BB app, however, sends every single character as if I've been pressing enter after each of them, which I haven't. Obviously this is something to do with buffering, what certain clients class as a EOL from the user input, etc. I just can't pinpoint it.

要说明这一点,这里是服务器输出从客户端接收的消息。

To illustrate, here is the server outputting messages it's received from the clients.

首先,从Linux客户端的消息:

First, the message from the Linux client:

client name: this is a test

现在,对于BBSSH:

Now, for BBSSH:

client name: t
client name: h
client name: i
client name: s
client name:
client name: i
client name: s
client name:
client name: a
client name:
client name: t
client name: e
client name: s
client name: t

任何帮助吗?

推荐答案

Telnet客户可以在线模式或字符模式下运行。所述BBSSH客户似乎在字符模式因某种原因操作

Telnet clients can operate in line-mode or character-mode. The BBSSH client seems to be operating in character-mode for some reason.

这可能是您的服务器可以通过发送客户端的效果的指令,在telnet连接的开始发生在协商过程中强制客户端进入行模式。

It's possible that your server could force the client into line-mode by sending the client an instruction to that effect during the negotiation that takes place at the start of a telnet connection.

你的服务器将需要发送给客户端的字节序列是0x255 0x253 0x34,意为国米preT为命令,执行,LINEMODE。如果客户愿意/能够行模式来操作,它应该0x255 0x251 0x34(国米preT为命令,威尔,LINEMODE)回答。

The byte sequence your server would need to send to the client is 0x255 0x253 0x34, which translates as "Interpret As Command, Do, Linemode". If the client is willing/able to operate in line-mode, it should reply with 0x255 0x251 0x34 ("Interpret As Command, Will, Linemode").

如果这是所有新的给你(即你的telnet服务器目前没有做任何谈判可言),谷歌对于喜欢telnet协商条款或看看一些相关的RFC(RFC 854本身的Telnet ,RFC 1184涵盖了LINEMODE选项)。

If this is all new to you (i.e. your telnet server currently doesn't do any negotiation at all), google for terms like "telnet negotiation" or take a look at some of the relevant RFCS (RFC 854 is Telnet itself, RFC 1184 covers the Linemode option).

这篇关于telnet客户及EOL治疗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆