TELNET

TELNET is a Virtual Terminal protocol used by 3270 emulation software. TELNET is defined by RFC 854.

Various attributes of terminal emulation and the session with the host are done via TELNET option negotiation. Basic TELNET option negotiation consists of each side sending options preceded by one of four verbs:
 * DO option
 * The sender is requesting that the receiver turn on option. The receiver should reply with WILL option or WONT option.


 * DONT option
 * The sender is requesting that the receiver turn off option. The receiver should reply with WILL option or WONT option.


 * WILL option
 * The sender is indicating that it has turned on option.


 * WONT option
 * The sender is indicating that it has turned off option.

Note that there aren't really any replies in TELNET. One side could send a WILL independent of the other side sending a DO. Each side is obliged to operate according to the options it has sent DO for, and the options that the other side has sent WILL for. At the beginning of a session, all options are assumed to be off.

TELNET also supports sub-option negotiation, where one side requests that the other send a sub-negotiation for a particular option, and the other replies with the sub-negotiation data.

TELNET uses character code 255 to identify its protocol messages. Code 255 is referred to as IAC (Interpret As Command).

3270 emulation over TELNET uses one of two methods, both of which are supported automatically by the x3270 family.

TN3270
This a set of conventions using existing TELNET negotiations, for setting up 3270 sessions. It is codified in RFC 1576. It has fairly limited capabilities.

TN3270E
This is an explicit option added to TELNET, defined in RFC 2355. It is much more flexible than TN3270. For example, each message can be explicitly acknowledged by the other side, and there is a protocol for conveying the BIND image to the emulator.

Line mode
TELNET supports two input modes: line mode and character mode.

In line mode, the terminal emulator accumulates a line of input, and does not send it to the host until the user presses the Enter key on the keyboard. The emulator is responsible for echoing typed characters and processing backspace and line-erase operations. In the 3270 family, line-mode resources define the keys used to control these operations.

In character mode, the terminal emulator sends each keystroke to the host, and the host is responsible for character echoing, and for processing backspace and line-erase operations.

Line mode is the default mode of operation in TELNET. The host can choose to explicitly enable character mode by TELNET negotiation.

There is no visible indication of whether the emulator is operating in line mode or character mode.