Detailed description of Telnet protocol standards

Source: Internet
Author: User
Tags printable characters

The concept of the Telnet protocol standard is described in detail in this article, and its features are also analyzed and introduced one by one. Hope to help you. For more information, see the following section.

Remote logon. The Telnet protocol standard is a key point. Are you still confused about this? Here we will introduce the principles and concepts of this part. First, let us have a correct understanding of this agreement.

Overview

The Telnet protocol is a member of the TCP/IP protocol family and is the standard protocol for the Internet remote login service. The purpose of the Telnet protocol is to provide a relatively common, bidirectional, eight-byte-oriented communication method that allows interface terminal devices and terminal-oriented processes to interact with each other through a standard process. The Telnet protocol can be used to convert the computer used by the local user into a terminal of the remote host system.

The Telnet protocol has the following features:

1. Heterogeneous adaptation

To make Telnet interaction between multiple operating systems possible, you must have a detailed understanding of heterogeneous computers and operating systems. For example, in some operating systems, each line of text needs to end with the ASCII carriage return controller CR), and in other systems, the ASCII line break LF is required ), there are also some systems that need to use a two-character sequence carriage return-line CR-LF); for example, most operating systems provide users with a shortcut to interrupt the program running, however, this shortcut key may be used by different systems using CTRL + C, while other systems using ESCAPE ). If the heterogeneity between systems is not considered, the characters or commands sent locally may be inaccurate or cause errors after being transferred to the remote and interpreted by the remote system. Therefore, the Telnet protocol standard must solve this problem.

To adapt to heterogeneous environments, the Telnet protocol defines the transmission mode of data and commands over the Internet. This definition is called the network Virtual Terminal NVTNet Virtual Terminal ). Its application process is as follows:

For the sent data: the client software converts the buttons and command sequences from the user terminal to the NVT format and sends them to the server. The server software will receive the data and commands, convert the NVT format to the format required by the remote system;

For returned data: the remote server converts the data from the remote server to the NVT format, while the local client then converts the received NVT format data to the local format.

2. Send remote commands

We know that most operating systems provide various shortcut keys to implement corresponding control commands. When you type these shortcut keys on a local terminal, the local system will execute the corresponding control commands, instead of using these shortcut keys as input. So for Telnet, what does it use to implement remote transmission of control commands?

The Telnet protocol standard also uses NVT to define how control functions are transmitted from the client to the server. We know that the USASCII character set includes 95 printable characters and 33 control codes. When you type a common character locally, NVT transfers it according to its original meaning. When you type a shortcut key combination, NVT transfers it to a special ASCII character over the network, and convert it to the corresponding control command after it reaches the remote machine. There are two main reasons for distinguishing the normal ASCII character set from the control command:

This distinction means that Telnet is more flexible: It can transmit all possible ASCII characters and all control functions between the client and the server;

This distinction allows the client to have no ambiguous specified signaling, without confusion between the control function and common characters.

3. Data Flow

One disadvantage of designing Telnet protocol standards as application-level software is: low efficiency. Why? The following shows the data flow in Telnet:

The data is typed by the user on the local keyboard and transmitted to the client program through the operating system. The client program processes the data and returns the data to the operating system. The data is transmitted over the network to the remote machine, the remote operating system sends the received data to the server program, and the server program processes the data again. Then, the system returns the Pseudo Terminal entry point on the operating system. Finally, the remote operating system transmits data to the application that the user is running. This is a complete input process, and the output is transmitted from the server to the client according to the same path.

Because the computer switches the process environment several times for each input and output, this overhead is very expensive. Fortunately, the user's input speed is not high. We can still accept this disadvantage.

4. Force Command

We should consider this situation: assume that the local user runs an endless loop of error commands or programs on the remote machine, and the command or program has stopped reading input, therefore, the buffer of the operating system may be full. In this case, the remote server cannot write data to the Pseudo Terminal and eventually stop reading data from the TCP connection, the buffer of the TCP connection will eventually be full, thus blocking the flow of data streams into the connection. If this happens, the local user will lose control of the remote machine.

To solve this problem, the Telnet protocol must use the out-of-band signaling to force the server to read a control command. We know that TCP uses an emergency data mechanism to implement out-of-band data signaling, so Telnet only needs to append a retained eight-bit group called date mark, then, the server can be notified by sending a packet segment with an emergency data bit over TCP. The packet segment carrying the emergency data will bypass the traffic control and directly reach the server. As a response to emergency signaling, the server reads and discards all data until a data mark is found. After the server encounters a data mark, it returns a normal processing process.

5. Option Negotiation

Due to the heterogeneity of machines and operating systems at the two ends of Telnet, the detailed configuration of each Telnet connection cannot be strictly specified as the telnet protocol standard. Otherwise, the adaptability to Telnet is significantly affected. Therefore, Telnet adopts the option negotiation mechanism to solve this problem.

The range of Telnet options is wide: some options extend the general functions, while some options involve some minor details. For example, there is an option to control whether Telnet works in half duplex or full duplex mode); there is also an option to allow servers on remote machines to determine small details of user terminal types ). The negotiation method of the Telnet option is also very interesting. It is symmetric for each option, that is, any end can send a negotiation application; any end can accept or reject this application. In addition, if one end tries to negotiate options that the other end does not know, the one end that accepts the request can simply refuse the negotiation. Therefore, updates and more complex versions of the Telnet client server may interact with older and less complex versions. If both the client and server understand the new options, the interaction may be improved. Otherwise, they will run together in a less efficient but workable manner. All these designs aim to enhance the adaptability to heterogeneity. We can see how important it is to the application and development of Telnet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.