Ftp working principle

  
        

The transmission of ftp has two modes: ascii transmission mode and binary data transmission mode. 1. Ascii transfer mode: Assume that the file being copied by the user contains simple ascii code text. If the file is not running on a remote machine, ftp usually automatically adjusts the contents of the file when the file is transferred so as to interpret the file as another computer. Stores the format of a text file. But there are often cases where the files being transferred by the user are not text files, they may be programs, databases, word processing files or compressed files (although the word processing file contains mostly text, which also contains the indicated page size). , non-printing characters of information such as fonts). Before copying any non-text files, use the binary command to tell ftp a copy-by-word copy. Do not process these files. This is also the binary transfer below. Recommended reading: FTP use command detailed 2. Binary transfer mode: In binary transfer, the bit order of the file is saved so that the original and the copy are bit by bit. Even if the file containing the bit sequence on the destination machine is meaningless. For example, Macintosh sends the executable file to the Windows system in binary mode. On the other system, this file cannot be executed. If you transfer binary files in ascii mode, they will still be translated even if they are not needed. This can make the transfer slower and damage the data, making the file unusable. (On most computers, the ascii method generally assumes that the first significant digit of each character is meaningless, because the ascii character combination does not use it. If you transfer binary files, all bits are important.) If you know these two The machine is the same, and the binary mode is valid for both text files and data files. How ftp works ftp supports two modes, one is standard (that is, port mode, active mode), and the other is passive (that is, pasv, passive mode). Standard mode The ftp client sends a port command to the ftp server. The passive mode ftp client sends the pasv command to the ftp server. The following describes how these two methods work: The port mode ftp client first establishes a connection with the tcp 21 port of the ftp server, and sends commands through this channel. When the client needs to receive data, it sends a port command on this channel. The port command contains the port on which the client receives data. When transmitting data, the server sends data through its own tcp 20 port to the specified port of the client. The ftp server must establish a new connection with the client to transfer data. The passive mode is similar to the standard mode when the control channel is established, but the port command is not sent after the connection is established, but the pasv command. After receiving the pasv command, the ftp server randomly opens a high-end port (port number greater than 1024) and notifies the client of the request to transmit data on the port. The client connects to the ftp server and the ftp server will use the port to perform data. Transfer, this time the ftp server no longer needs to establish a new connection with the client. Many firewalls are not allowed to accept externally initiated connections when setting up, so many ftp servers behind the firewall or intranet do not support pasv mode, because the client cannot open the high-end port of the ftp server through the firewall; The client of the network cannot log in to the ftp server in port mode, because the tcp 20 from the server cannot establish a new connection with the client of the internal network, causing it to be inoperable.

If you don't know how to use ftp Something, that is a good solution, as long as it is the next ftp software, such as flashfxp, ultrafpp, etc., the input address is directly downloaded. If you want to build a ftp site, you have to do the software configuration yourself and use server-u or other software to set it up directly.

Copyright © Windows knowledge All Rights Reserved