Talk about BBS Term Design

zhaozj2021-02-11  273

Abstract: Terminal is a terminal control software based on Telnet protocol, fully supports Telnet client login remote system, and can also be a client software designed for BBS (electronic public bill), which can automatically determine that the user is on Environmental status and you can provide many tools to strengthen support for BBS. TERM's proposal: Everyone is well known to the Telnet client in Windows98 and previous versions, which does not support ANSI color, and some non-standard control code, and these are more important in BBS, and the other Serious problems is that there is very high in garbled, which is for remote control servers or its inconvenient, in addition, for BBS users, Windows Telnet does not provide special BBS feature support, although Windows 2000 Telnet has joined the support of ANSI color, but some BBS is not standardized in the BBS and some of the features that meet BBS use are still not enough, so TERM's proposal is very necessary. Design: Term's core is a Telnet protocol here brief introduction to its implementation

1 Overview

(1). User Terminal Telnet protocol defines a tool interactive, which allows users to communicate with a server process. Telnet defines an interactive, character-oriented communication. The protocol illustrates a network virtual terminal (NVT, Network Virtual Terminal) composed of keyboard and display. And it develops a character set, whenever the client sends data, the terminal character representation maps to the NVT character table when the client is received, and the NVT character is mapped to the native characters when receiving the data. Symmetrical structure. (2). The control command Telnet protocol defines some command strings to indicate what operations should be taken, what state is entered, and through special arrangements, so that these strings can be separated from the packet (3). Pair "concurrency "The need for Telnet is conceptually transmitted between client terminals and remote services, which uses native system functions when interacting with the user terminal, which uses a TCP connection when communicating with the remote service.

In order to provide a full duplex connection between the user terminal and the remote service, the Telnet client must complete two tasks at the same time: the client must read the input on the keyboard and send them to the remote service client on the TCP connection. The character must be read from the remote service of the TCP connection and displayed on the screen of the user terminal because it is very likely to be simultaneous, so there must be a concurrency, in Windows, we can use the message mechanism to meet this "Concurrency" requirements (not true concurrency). (4) Telnet model:

(5) Protocol: Initialize the Telnet class, initialize the Telnet section in the Telnet section in each default color property, status property, and system settings. Open a TCP connection by the user specified by the user's remote host address. Block until the user is type Or the data arrives from the TCP connection (through the message mechanism, generating a WM_KEYDOWN message when the user typed, when the data is reached, the TClientSocket class gets a SeREAD message) data from the user (receiving a WM_KEYDOWN message), Treated it and translate it into an NVT representation, and then the NVT is transmitted through the TCP; the data is connected from the TCP connection, then the translation cost machine character is represented (when the processChar process can be used, and the parameter of the process A character) and is displayed on the unit. Returns Step 3 and loop until the TCP connection is disconnected.

2. Finite state machine FSM (Finite State Machine)

Most Telnet implementations use a finite state machine to illustrate the exact grammatical syntax of the command sequence and the explanation of the command sequence. On the one hand, it exacts how the sender embeds the command sequence in the data stream, and the other hand, it is otherwise explained how to explain it, so the limited state machine can implement the Telnet protocol. The limited state machine refers to the state of the current terminal in limited, and has been defined in a state in which the current should be in what state should be in what state it is? That is the command sequence from the server side, below is a limited state machine Schematic: In some Telnet, three FSM finite state machines are used, a response to the keyboard event, a character from the TCP connection, one processing option sub-negotiation details, but because this will increase the system overhead, So use the compressed FSM matrix in some programs, I still don't think about this mechanism, because we can use the Windows message mechanism to do this, so I recommend using an FSM finite state machine, which is integrated. The above three FSMs (not fully fused, the body part is processing from the TCP connection character).

3. User status intelligent judgment implementation

User status mainly refers to the state of the user in BBS, such as the top station, main menu, looks at the four parties, discussion groups, reading articles ... etc., How do we judge these states? Since the Telnet protocol is character oriented, these The characters can only be judged by character characteristics, as the BBS site does not provide a special command sequence to represent these states, so there is a site that may cause failure.

4. Implementation of non-standard ESC control code

Some non-standard ESC controls are defined in BBS, so these control codes must be supported, and the non-standard control codes are flickering, delay, font transformation flashing: (with 5 commands, such as: * [1; 5; 32M is a flashing green character] In order to implement a flashing character, we can use a certain time to refresh the screen once. While refreshing the screen, use a sparkling character status variable to control the realism, what The character should not be displayed (the non-displayed characters used here are the same color), in addition, the user can customize this time interval in the system settings. Delay: Delay is BBS to make up for graphics, especially dynamic The graphic is a very good way to make a lot of dazzling full-time animation effects. The delay implementation requires the output of the character flow mode. When it encounters the delay control code, you can use SLEEP to sleep. The parameter of the SLEEP is caused by the parameters inside the control code, such as: * [1000M delayed 1 second, 1000 milliseconds. Font transformation: Font transformation is a non-standard ANSI control code, this non-standard can be implemented at the client The following representation is used in BBS * [1i Song * [2i black body * [3i 体 * [0i cancels the default 5. Each functional implementation overview

First, in order to ensure the normal implementation of the function, it is necessary to intelligently determine whether the user can perform the correct state of the function, which is the judgment status problem that is mentioned earlier. This is better to develop these functions. These features are implemented using the automatic sending keyboard input, some is integrated with some control code, and of course the message manager is completely using message storage and then encrypting the method.

Function: Article editor information input article reading tool article Download Tool Essence Area Operation Tool Message Manager

to sum up:

The core of TERM design is the implementation of Telnet protocol algorithm and ESC control code and additional functionality.

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

New Post(0)