NVT

The purpose of the telnet protocol was fairly simple: allow a user to login to a remote host and work as if she was working locally. In order to achieve this, once connection was initiated all user's input needed to be transferred to the host, and host's output needed to be transferred back to the user's client machine.

However, this was not that simple as old computers tended to be highly proprietary and not interoperable. They did not have the same hardware or software, language encodings or control commands. Thus, there were two possible options:

Naturally, the second option was chosen. The NVT -Network Virtual Terminal- is the common "language" all hosts and terminal use when communicating with each other. Logically, The NVT is an imaginary bi-directional character device that has a printer and a keyboard. The printer responds to incoming data and the keyboard produces outgoing data which is sent over the telnet connection. The NVT contains definitions of the data and commands the client and server can send each other. It defines a set of rules for how information is formatted and sent - character sets, line termination etc. and how information about the telnet session itself is sent. NVT ASCII is also used by many other internet protocols.

Architecture: each device that communicates via telnet and NVT 'understands' both its 'native language' and the common 'NVT language'. While the end user types data into her terminal, it is translated from the client's language to the NVT common language. Then it is transmitted over then network in NVT format. When the telnet server receives it, it is translated again from NVT to the server's local language. The same process also works in the opposite direction.

NVT uses the 95 printable ASCII characters as they are defined in ASCII. Out of the remaining 33 control characters, the following are used:

codeASCIIdescription
0 NUL No operation (has no effect on output)
7 BEL Sound audible/visible signal (no motion)
8 BS Move left one character position
9 HT Move right to the next horizontal tab stop
10 LF Move down (vertically) to the next line
11 VT Move down to the next vertical tab stop
12 FF Move to the top of the next page
13 CR Move to the left margin on the current line
other other No operation (has no effect on output)

Negotiation

To enhance the basic common NVT protocol, telnet options are used. If the terminal or the host want to use a certain option, a process of negotiation takes place. The option negotiation mechanism allows the user to set terminal parameters to values other than the default or to negotiate more sophisticated facilities. The telnet protocol negotiation mechanism is symmetrical, and can be initiated by either side. Besides negotiating whether or not a particular option is to be in effect, the mechanism also allows one to specify, when appropriate, which side is to perform the function. For example, a user may negotiate the Echo option and specify whether echoing is to be done locally or remotely to the initiator of the negotiation.

Four telnet commands support option negotiation (DO, DON'T, WILL and WON'T).

For example, suppose the terminal wanted to use binary transmission. It would send a DO Binary Transmission to the remote host. The host could then respond with either a WILL Binary Transmission (a positive acknowledgment) or a WON'T Binary Transmission (a negative acknowledgment). If the terminal does not want its characters echoed across the telnet connection, it would send WON'T Echo; If the remote host agrees that no characters will be echoed, it would return DON'T Echo.