Telnet protocol introduction ...

xiaoxiao2021-03-06  56

1 basic content

The Telnet protocol is a member of the TCP / IP protocol, which is the standard protocol for Internet remote login services. The Telnet protocol can turn the computer used by the local user into a terminal of the remote host system. It provides three basic services:

1) Telnet defines a network virtual terminal to provide a standard interface. The client program does not have to learn from the remote system in detail, and they only need to construct the program that uses the standard interface;

2) Telnet includes a mechanism that allows client and server negotiation options, and it also provides a set of standard options;

3) Telnet symmetrically handles both ends of the connection, that is, Telnet does not force the client from the keyboard input, or forcing the client to display the output on the screen.

2 adapt to heterogenesis

In order to make a Telnet interaction between multiple operating systems, it is possible to learn more about heterogeneous computers and operating systems. For example, some operating systems require each line to end with the ASCII Enter Control (CR), and other systems need to use the ASCII wrap (LF), and some systems need to enter the sequence of two characters - Renewal (Cr) -LF); for example, most operating systems provide users with shortcuts for interrupt programs run, but this shortcut may be different in each system (some systems use Ctrl C, while others use ESCAPE). If it is not considered to be isomerism between the system, the character or command sent locally or command is transmitted to the distance and is interpreted by the remote system, it is likely to be inaccurate or an error occurs. Therefore, the Telnet protocol must solve this problem.

In order to adapt to the heterogeneous environment, the Telnet protocol defines the transmission mode of the data and commands on the Internet, which is referred to as a network virtual terminal NVT (Net Virtual Terminal). Its application process is as follows:

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

For returned data: The remote server converts data from the format of the remote machine to NVT format, and the local client will convert the received NVT format data to a local format.

For detailed definitions in NVT format, interested friends can find relevant information.

3 transfer far orders

We know that most of the operating systems provide various shortcuts to implement the corresponding control commands. When the user typed these shortcuts in the local terminal, the local system will execute the corresponding control command without using these shortcuts as input. So what is it used for Telnet? What is the remote transmission of the control command?

Telnet also uses NVT to define how to transfer control functions to the server from the client. We know that the USASCII character set includes 95 printable characters and 33 control codes. When the user types a normal character from locally, NVT will be transmitted according to its original meaning; when the user types the shortcut (key), the NVT will convert it to a special ASCII character to transmit it on the network, and arrive at the remote machine After converting to the corresponding control command. There are two main reasons to distinguish between the normal ASCII character set and the control command:

1) This distinction means that Telnet has greater flexibility: it can transmit all possible ASCII characters and all control functions between clients and servers;

2) This distinction allows the client to specify signaling without means, without the confusion of control functions and ordinary characters.

4 data flow direction

Above we mentioned that there is a shortcoming of the Telnet design as the application level software, that is: the efficiency is not high. Why is this? The data flow in the Telnet is given: data information is typed by the user from the local keyboard and passed the operating system to the client program, the client program returns its processing and returns the operating system, and is transmitted by the operating system to the remote machine. The remote operating system passes the received data to the server program, and returns to the pseudo terminal entry point on the operating system by the server program again, and finally, the remote operating system transmits the data to the user being running, this It is a complete input process; the output will be transferred from the server from the server to the client.

Because each input and output, the computer will switch the process environment several times, this overhead is very expensive. Fortunately, the type of user is not high, this shortcomings are still acceptable.

5 forced order

We should consider such a situation: assuming that the local user runs an error command or program that has an endless loop of the remote machine, and this command or program has stopped reading input, then the buffer of the operating system may be occupied Full, if so, the remote server cannot write data to the pseudo terminal, and ultimately lead to stopping the read data from the TCP connection, and the buffer connected to the TCP will ultimately be full, causing blocking the data stream from flowing into this connection. If the above is really happening, the local user will lose control of the remote machine.

To resolve this issue, the Telnet protocol must use an outer signal order to force the server to read a control command. We know that TCP implements takes data signaling with emergency data mechanisms, then Telnet will add a reservation eight group called data mark (Date Mark), and send the TCP to send a report segment that has set emergency data bits. The server is OK, and the newspapers carrying emergency data will reach the server directly from the traffic control. As a corresponding to the emergency signaling, the server will read and discard all data until a data tag is found. The server will return a normal processing process after encountering the data tag.

6 option negotiation

Due to the isomer of the machine and operating system at both ends of Telnet, the Telnet is not possible to specify the detailed configuration of each Telnet connection, otherwise it will greatly affect the adaptive isomer of Telnet. Therefore, Telnet uses an option consultation mechanism to solve this problem.

The Telnet option has a wide range: Some options expand the functionality of the big direction, and some options involve some minor details. For example: A option can control Telnet working in half a duplex or a full-duplex mode (large direction); there is an option to allow the server on the remote machine to determine the user terminal type (small detail).

The negotiation method of the Telnet option is also very interesting, it is symmetrical for each option, that is, any end can issue negotiation applications; any end can accept or reject this application. In addition, if one end is attempting to negotiate an option that does not understand the other end, the end of the receiving request can be simply denied negotiation. Therefore, it is possible to interact with the update, more complex Telnet client server versions to be older, less complex version. If both clients and servers understand new options, they may improve their interactions. Otherwise, they will run together to run with low efficiency but work. All of these designs are to enhance the adaptation of isomer, how important it is to meet the application and development of Telnet.

Some of the principles are discussed above, although we are difficult to get in touch with this level during the use of Telnet, but I think it makes sense, it will bring us many enlightenment.

转载请注明原文地址:https://www.9cbs.com/read-109680.html

New Post(0)