跳到主要内容

选项说明

WILL 和 DO 仅用于获取和授予今后进行讨论的许可。状态信息的实际交换发生在选项子命令(IAC SB STATUS...)之内。

两台主机交换了 WILL 和 DO 之后,WILL STATUS 的发送方可以自由地传送状态信息,既可以主动传送,也可以响应 DO 发送方的请求。最坏的情况下,这可能导致同一信息被传送两次。只有 DO 的发送方可以发送请求(IAC SB STATUS SEND IAC SE),也只有 WILL 的发送方可以传送实际的状态信息(在 IAC SB STATUS IS ... IAC SE 命令之内)。

IS 带有子命令 WILL、DO 和 SB。它们的用法与 TELNET 选项实际协商期间的用法完全一致,只是 SB 以 SE 而不是 IAC SE 结束。要把 SE 作为普通数据字节传送,需将该字节重复一次(SE SE)。未明确描述的选项被假定处于其默认状态。一条 IAC SB STATUS IS ... IAC SE 即描述所有选项的状况。

下面是该选项的一个使用示例:

Host1: IAC DO STATUS

Host2: IAC WILL STATUS

(Host2 is now free to send status information at any time.
Solicitations from Host1 are NOT necessary. This should not
produce any dangerous race conditions. At worst, two IS's will
be sent.)

Host1 (perhaps): IAC SB STATUS SEND IAC SE

Host2 (the following stream is broken into multiple lines only for
readability. No carriage returns are implied.):

IAC SB STATUS IS

WILL ECHO

DO SUPPRESS-GO-AHEAD

WILL STATUS

DO STATUS

IAC SE

Explanation of Host2's perceptions: It is responsible for echoing
back the data characters it receives over the TELNET connection;
it will not send Go-Ahead signals; it will both issue and request
Status information.