III(续). Break、用户 Telnet 信号与术语
Break 与 Attention
有些终端具有一种特殊控制信号,它在 ASCII 中没有对应的位模式,而是通过特殊的电信号传送。这种控制信号在 2741 上称为 Attn,在 Teletype 上称为 Break。该信号由 Telnet 控制信号 BREAK 表示。从服务站点发往使用站点的反向 break 也有相应的控制信号。但要注意,NVT 是双向字符设备,因此无需“调转线路方向”。
有些系统把 Break 当作可与数据流配合使用的额外编码。例如,某系统把 Break 用作特殊的编辑码,含义是“删除当前行到此为止的内容”。在这种情况下,该编码可以直接插入数据流,用户无需任何特别的额外操作。
另一些系统以特殊中断方式使用 Break 或 Attn,含义是停止处理应用程序并把监督程序交还给我,或取消当前作业等。(其他逐字符检查输入的系统,则为此使用普通字符,例如 <etx>。)在这些情况下,由于服务站点与使用站点的运作方式不同,除了正常的 Telnet 数据流之外,还需要另走一条途径,以表明特殊控制信号已嵌入数据流中。
示例——问题:
PDP-10 的输入缓冲区满时,通常仍会继续接收来自终端的字符,逐个检查其是否为控制字符,是则据此处理,否则丢弃。
由于服务站点的 Telnet 服务器在控制成批到达方面受制于 NCP,因而在字符突发到达 Telnet 时也受制于它,可以预期 Telnet 实现会扼制流向缓冲区的数据,直到缓冲区准备好接收字符而不再将其丢弃。
在这种情况下,服务进程可能正在向使用终端输出,服务器的输入缓冲区被(用户产生的字符)填满,而
<etx>就卡在(用户站点处)被扼制的数据流中。
对于 Multics 或某些按行服务的 IBM 系统,也可能出现类似的问题。使用站点的用户使自己在服务站点的进程陷入输出循环,想要中断该进程,又不想释放其 Telnet 连接。缓冲区堵塞了连接,传输被扼制,<etx>、Break 或其他用户控制信号便卡在了管道里。
示例——解决办法:
使用站点的用户知道自己正在输入一个特殊控制信号(Break、Attn、
<etx>等),并在其后跟一个 SYNCH。(各使用站点实现这一点的本地说明可能各不相同。)
User to Using Site Telnet
Send SYNCH.
Using Site Telnet to Serving Site Telnet:
DATA MARK in Data Stream.
Using Site Telnet to Using Site NCP:
Send an INS.
Serving Site NCP to Telnet Server:
Interrupt "INS received".
Serving Site Telnet:
Examines the input data stream (looking for special control
signals) until it sees DATA MARK then resumes normal
handling.
这样,视服务器本地实现能否提供足够的服务而定,每当收到 INS 时,便可启动对数据流的特殊处理,以到达该特殊字符。当它看到 DATA MARK 时,便将其识别为同步点;由于知道特殊字符已被越过,便从数据流中剥去 DATA MARK,并返回正常模式。
如果 DATA MARK 先于 INS 到达,服务站点在收到 INS 之前不应进一步处理数据流。
这种处理特定特殊字符或信号的方法,使使用站点的 Telnet 进程无需识别服务站点的特殊字符,也无需知道服务站点希望如何处理它们。同时,该过程只要求用户对服务站点有最低限度的了解。这似乎是恰当的,因为 Telnet 的 ASCII 约定提供的是网络虚拟终端,而不是网络虚拟用户。
注意,正确的顺序是:(1) 特殊字符或信号(例如 BREAK 或 <etx>),然后 (2) SYNCH。
用户 Telnet 信号
用户能够使使用站点的 Telnet 以字符串形式发送任意 ASCII 字符组合,并且仅发送该组合,这被认为对 Telnet ASCII 约定对用户的实用性十分重要。因此,有些用户站点可能认为有必要提供从人类用户到使用站点 Telnet 的特殊本地 Telnet 信号。
示例:
一位用户所在的是按行处理的系统(Multics、System 360、GCOS 等),这类系统在处理用户输入前需要行结束信号。该用户通过网络在一个逐字符运行的服务站点上工作。应用程序是一个调试辅助工具,允许用户键入“location=”,它会以 n 作答,其中 n 表示该存储单元的当前内容。服务站点的进程并不期望看到“location=”后面跟着回车换行序列。使用站点的用户应当能够键入该地址,随后发出一个(给用户 Telnet 的)信号以抑制行结束约定,再发出行结束信号,并期望“location=”被立即发送,而不向服务器发送行结束序列。
示例:
在另一种情况下,某使用站点认为每次累积四个字符再发送给服务站点比较方便,除非观察到行结束信号;此时,行结束序列将随已累积的字符(大概是三个或更少)一并发送。在同一调试应用中,地址的结尾与四字符缓冲区的分界并不一致。用户应当能够输入“立即发送”编码来代替行结束信号,以保持整洁的格式,并期望该地址被发送到服务站点。
Telnet 信号已经讨论过,迄今引入的那些对于实现 Telnet ASCII 约定大概已经足够。
术语
ASCII - The USASCII character set as defined in NIC # 7104.
In Telnet Protocol, where eight bit codes are used
the lower half of the code set is defined to be
ASCII.
echoing - The display of a character entered is called echoing.
There are two modes in which this happens. If
the device used to enter characters displays the
character before (or as) it transmits the character
to the computer the echoing mode is called "local
echo." If, on the other hand, the device transmits
the entered character to the computer without
displaying it and the computer then transmits a
character to the device for the echo display, this
echoing mode is called "remote echo."
character mode - In this mode of operation Telnet transmits each
character as soon as possible. Generally speaking,
character mode is used when all of the using terminal,
using system, and serving system are operating
in a remote echo mode. The echos to the user
entered characters are transmitted from the serving
system (i.e., over the network).
line mode - In this mode of operation Telnet transmits groups
of characters which constitute lines. Generally
speaking, this mode is used when one or more of
the using terminal, using system, or serving
system is operating in a local echo mode. The
echos to the user entered characters are not
transmitted over the network).
full duplex - This term indicates a transmission procedure using
a four wire connection, which permits simultaneous
transmission in both directions.
half duplex - This term indicates a transmission procedure using
a two wire connection, which requires that data be
transmitted in only one direction at at time.
注意,半双工设备通常也是本地回显,而全双工设备既可以是本地回显,也可以是远端回显。