FTP brief translation

zhaozj2021-02-08  283

FTP working principle

One: FTP's goal

1) Expand file sharing;

2) Encourage indirect use of remote computers;

3) Use the household to avoid the trouble of different file storage systems between different hosts;

4) Reliable, efficient data transmission;

2: Main terms

1) Control Connection: One of the communication paths between users and servers for exchange commands and response information. Telnet protocol rules.

2) Data Connection: The full-duplex mode is used to transfer data in specific modes and types. The transferred content can be part of a file, a complete file, or multiple files. The transfer path can be located between the user _dtp and server _dtp, or between the two servers.

3) Data Transfer Process: Establish, manage data connections, can be active or passive.

4) Response: The confirmation information of the response its FTP command is sent by the server via the control connection.

The usual form is an encoding including an error code, a text string. The code is processed by the program, and this information is provided to the user.

5) Server Data Transfer Process (Server_DP): Server_DTP is usually in the "active" state, which is connected to the data port used to listen. He is responsible for establishing a parameter set for transmission and storage, and relying on the command transmitted data received by its protocol interpreter.

6) Server _FTP process (server_ftp process): is one or more processes that perform file transfer features that communicate with the user FTP process or another server process. These features include protocol interpretation and data transfer processing.

7) Server-Protocol Interpreter: Server_pi: It is listened to the connection information from the client on port 'L' and establishes a control communication connection. He receives the standard FTP command from the user, sending response information, and manages server _dtp;

8) User_DTP (user_dtp): User_DTP listens to connection information from the server _FTP process on the data port.

9) User_FTP Process (user_ftp process): It is a function set including PI, DTP, and a user interface, which performs file transfer with one or more FTP server processes.

Three: Working mode

1:

User Protocol Interpreter (user_pi) launch control connection, control connection compliance with Telnet protocol rules, after the user is initialized, generates a standard FTP command by user_pi, and transmits it to the server via the control connection, and send it to user_pi to the user. The response information of the command.

The ftp command specifies the parameters required to establish a data connection and the operations you want to make a file system.

User__dtp listens on the specified data port, the server starts the data connection and executes the data transfer of the specified parameter.

Its work schematic is shown in the figure:

Data Connection

FTP Commands

FTP Replies

Server_pi

Server_dtp

File system

User interface

User

Pi

User

DTP

File

SYSTEM

User

Server FTP

User FTP

2:

Another situation is that the user wants to transmit data between two hosts, both of which are not locally. The user establishes a control connection with two hosts and arranges the data connection between them. In this mode, the control information is issued by user_pi, but the data is passed between two Server_DTPs. Working principle is as follows: Server_FTP

"A"

Server_ftp

"B"

User_ftp

User_pi

CONTROL

CONTROL

Data Connection

Four orders classification

1) Access control command (Access Control Commands): Set the login account and password, use permissions.

Example: User --- User Name; Pass-Password; ACCT --- Account;

CWD --- Change Working Directory; CDUP --- Change to Parent Directory

SMNT-STRUCTURE MOUNT (setting new transport structure); Rein --- Reinitialize; Quit --- Logout

2) Set Transfer Parameter Commands: All data transfer parameters have default, when you want to change the default value, use these commands to set your own value;

Example: Port-Data Port (changing the default data port);

Pasv-passive (set Server_DTP to 'passive') to listen to data connections on the data port, not to start a data connection);

TYPE --- Repesention Type (set the file representation type);

STRU --- File Structure (setting file structure);

Mode --- Transfer Mode;

3) FTP Service Command (FTP Service Commands): Defines file transfer and file system feature, usually needs

The parameter is the path name (Pathname)

Example: Retr-Retrieve: This command enables the server _dtp to transfer the file copy specified by the file name to the server or user DTP of the other end.

STOR --- Store: This command allows the server DTP to receive data transmitted through the data, and store it as a file.

APPE --- append; allo-allocate; rest --- restart; RNFR-RENAME FROM

RNTO --- Rename To; Abor --- Abort; dele --- delete; remar - remove directory;

MKD --- Make Directory; PWD --- Print Working Directory; List-List;

NLST-Name List; Site --- Site Parameters; SYST --- System; Stat --- Status;

Help --- Help;

Six: Transmission parameters introduction

1: Data type (data types): Used for Type command, ie Presention Type;

1) ASCII type;

This is the default value, all FTP executives must receive this value, which is generally used to transmit text files. The sender converts the data from the internal character representation to the standard 8-bit NVT-ASCII type, and then the receiver converts it to the internal format of the native.

2) EBCDIC type:

This type is suitable for efficient transmission between two hosts that use EBCDIC as a host in its internal format. During transmission, data is represented using an 8-bit EBCDIC character. 3) Image type:

When this type is used, the data is packaged into an 8-bit transmission byte as a continuous bit. The receiver must store these data as a continuous bit. This type is suitable for efficient storage, file recovery, and binary data transmission, which is recommended to be accepted by all FTP executables.

4) Local type:

When using this type, the data must be specified on the second parameter in the second parameter when transmitted with this type. Indicates that the value of the byte size must be a decimal integer. The logical byte size is not necessarily the same as the transmission byte. When they differ, the data will be packaged in logic bytes, regardless of the boundary of the byte, and the necessary fill is performed at the end.

2: Data structure: Used for STRU commands.

As a supplement to the type, FTP must specify the file structure. There are three file structures defined in the FTP:

1) File-structure: The file is considered a continuous data byte sequence without internal structure.

2) RECORD-STRUCTURE: The file consists of continuous records.

3) Page-structure: The file consists of a separate index page.

3: Transmission Modes: Used for MODE commands.

There are three transmission modes: stream mode, block mode, and compression mode. All data transfer must end with EOF, which makes it expressly or implies to close the data connection.

1): Stream mode): STREAM MODE

When the data is transmitted in the form of a word stream, the type of representation is not limited, allowing the file to use the recording structure. If the file structure is used, the EOF indicator of the transmission end will represent the closing data connection.

2): Block Mode:

In this mode, the file is transmitted in a series of data blocks, each data block has a header, and the header byte can be one or more bytes. The header is included in a value domain and a description of the encoding. The value domain indicates how many bytes of this data block, which also indicates the starting bit of the next data block. Describe the contents of the encoding definitions: 128-data block is the end of Er (end of record); 64 - The end of the data block is EOF (end of file); 32-data block may have errors; 16-data The block is a retransmission marker.

4) Compressed Mode:

This mode has three transport forms:

If the representation is an ASCII or EBCDIC code, the padding byte is is space. If the image type (image type) or local type (local type) is populated by 0 (zero).

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

New Post(0)