Telnet Protocol Basic Knowledge We know that Telnet server software is our most commonly used remote login server software, is a typical client / server model service, which applies Telnet protocols. So what is the Telnet protocol? What are it characteristics? 1 Basic Content 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. They only need to construct programs that use standard interfaces; 2) Telnet includes a mechanism that allows client and server negotiation options, and it also provides a set of standard options; 3) Telnet symmetrical processing connection At both ends, Telnet does not force the client from the keyboard input, or forced the client to display the output on the screen. 2 Adaptation of Heterogeneration In order to make a Telnet interaction between multiple operating systems, it is necessary 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 data transmitted: 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 far The format required for the system; for the returned data: The remote server converts the data from the remote machine format to NVT format, and the local client will convert the received NVT format data to the local format. For detailed definitions in NVT format, interested friends can find relevant information. 3 Transfer far or order us to 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 perform the corresponding control command, without putting it Shortcuts are used 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 for normal ASCII character sets and control commands: 1) This distinction means that Telnet has greater flexibility: it can transmit all possible ASCII characters and all control functions between clients and servers; This distinguishes makes the client may have no confidence in which the control function is confusing with the normal characters. 4 Data flow to the above, we mention that there is a shortcoming of the Telnet design as the application 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 Force ordered us should consider: Assuming that the local user runs an endless loop of the remote machine, and this command or program has stopped reading, then the buffer of the operating system may therefore It is accounted for, if so, the remote server cannot write the data to the pseudo terminal, and ultimately result in stopping the data from the TCP connection to read data, the buffer connected to the TCP will ultimately be full, resulting in blocking data flow flow This connection is connected. 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 Options negotiation Due to the isomer of the machine and operating system across the Telnet, the Telnet is not possible to strictly define 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.