1, function and use: port 2 1 This is the control connection port of FTP. When the FTP connection is established, the client will connect to port 2 1 of the remote server for sending commands (such as logging in, listing directories, deleting files, etc.). ) and receive a response from the server. In short, it is the control channel for establishing and managing FTP sessions. Port 20 This is the data connection port of FTP. When executing a command that needs to transmit data (such as downloading or uploading files), the client will establish a data connection with port 20 of the server, which is dedicated to transmitting file data. This design allows FTP to keep the activity of control connection during data transmission, thus improving efficiency.
2. Connection mode: No matter in active mode or passive mode, port 2 1 is always used to establish the initial FTP control connection. In port 20 active mode, the client uses port 20 to open the data connection; In passive mode, the server will randomly select a port to open the data connection and notify the client to connect to the port. This means that port 20 cannot be used directly in passive mode.
3. Concurrency and activity: The control connection of port 2 1 is active during the whole FTP session, and it is used to continuously send and receive commands and responses. The data connection of port 20 is temporary, and is establish only when data needs to be transmit. Once the data transmission is completed, the data connection will be closed, while the control connection will remain open for subsequent command and response interaction.