6. やり取りの例
この例の記述には RFC 726 の表記法を用いる。同 RFC から引用すると次のとおりである。
"S:" is sent from serving host to using host.
"U:" is sent from using host to serving host.
"T:" is entered by the terminal user.
"P:" is printed on the terminal.
角括弧 ([]) で囲まれたテキストは注釈である。山括弧 (<>) で囲まれたテキストは 1 つの単位として扱う。たとえば、キャリッジリターンは <cr>、10 進値 27 は <27> と表される。
ユーザは Telnet 接続を確立してログオンしており、アプリケーションプログラムが、ユーザによって直接、または定型の起動手順によって起動されたばかりであると仮定する。ページ上の表示は単に要素をまとめるためのものであり、メッセージの境界の位置を意味しない。対話のどの部分も、1 つまたは複数のメッセージとして送られうると考えるべきである。プログラムまたは Telnet の最初の動作は、DET オプションのネゴシエートである。
S: <IAC><DO><DET>
U: <IAC><WILL><DET>
S:<IAC><DO><OUTPUT PAGE SIZE> [First negotiate the screen
size. In this case we are
U:<IAC><WILL><NAOP> asking the user the size of the
terminal. This could have been
U:<IAC><SB><NAOP><DR><25><IAC><SE> done before the DET option was
negotiated.]
S:<IAC><SB><NAOP><DS><0><IAC><SE>
S:<IAC><DO><OUTPUT LINE WIDTH>
U:<IAC><SB><NAOL><DR><80><IAC><SE> [Defines the screen to be 25
lines by 80 characters.
S:<IAC><SB><NAOL><DS><0><IAC><SE> The server may use this
information when formatting
the screen.]
S:<IAC><SB><DET><FORMAT FACILITIES> [Now set the terminal attributes.]
<Repeat><Protection, 3 Levels
Intensity><IAC><SE>
U:<IAC><SB><DET><FORMAT FACILITIES>
<Repeat, Blinking><Protection, 3
Levels Intensity><IAC><SE>
S:<IAC><SB><DET><ERASE SCREEN><IAC><SE> [Erase the screen and
start sending the form.]
<IAC><SB><DET><FORMAT DATA>
<Protection=1, Intensity=1><0>
<5><IAC><SE>Name:
<IAC><SB><DET><MOVE CURSOR><0><1>
<IAC><SE>
<IAC><SB><DET><FORMAT DATA>
Protection=1, Intensity=1><0>
<8><IAC><SE>
Address:
<IAC><SB><MOVE CURSOR><0><4><IAC>
<SE>
<IAC><SB><DET><FORMAT DATA>
Protection=1, Intensity=1><0>
<17><IAC><SE>
Telephone number:
<IAC><SB><DET><MOVE CURSOR><32><4>
<IAC><SE>
<IAC><SB><DET><FORMAT DATA>
Protection=1, Intensity=1><0>
<24><IAC><SE>
Social Security Number:
<IAC><SB><DET><FORMAT DATA> [Establish a field that doesn't
<Protection=1, Intensity=7> display what is typed into it.]
<0><11><IAC><SE>
<IAC><SB><DET><MOVE CURSOR><32>
<5><IAC><SE>
<IAC><SB><DET><FORMAT FACILITIES> [Get permission to use Blinking
<Blinking><0><IAC><SE> Attribute.]
U:<IAC><SB><DET><FORMAT FACILITIES>
<Repeat, Blinking><Protection,
3 Levels Intensity><IAC><SE>
S:<IAC><SB><DET><FORMAT DATA>
<Blinking=1, Protection=1,
Intensity=1><0><29><IAC><SE>
Your SSN will not be printed.
<IAC><SB><DET><HOME><IAC><SE>
<IAC><GA>
ここまでのやり取りで、画面上には次のような書式が置かれた。
Name:
Address:
Telephone Number: Social Security Number:
"Your SSN will not be printed."
ここで、引用符で囲まれた文字列は点滅している。
端末ユーザは、提供された書式に自由に記入できるようになった。ユーザは最初のフィールドの先頭にカーソルを置き (通常はタブキーを押して行う)、入力を始める。このやり取りは、User Telnet プログラムやネットワークとのやり取りを生じさせないため、ここには示さない。端末ユーザが書式への記入を終えると、書式の非保護部分を送信するために送信キーを押すが、その前に User Telnet プログラムが Field Separator サブコマンドを圧縮するために Byte Macro Option をネゴシエートする。
U:<IAC><DO><BM> [Negotiate Byte Macro Option.]
S:<IAC><WILL><BM> [Define decimal 166 to be the
Field Separator subcommand
U:<IAC><SB><BM><DEFINE> (see Appendix 3)]
<166><6><IAC SB DET FIELD
SEPARATOR IAC SE><IAC><SE>
S:<IAC><SB><BM><ACCEPT><166> [The server accepts the macro.]
<IAC><SE>
U:<IAC><SB><DET><DATA TRANSMIT><0><6>
<IAC><SE>
John Doe <166> 1515 Elm St., Urbana, Il 61801
<166> 217-333-9999 <166> 123-45-6789 <166>
S:<IAC><SB><DET><ERASE SCREEN><IAC><SE>
Thank you.
以下同様である。