6. Application Layer (3) File Transfer Protocol (FTP)

Transferring files from one computer to another computer that may be far away over the network is a basic network application, namely file transfer.

File Transfer Protocol (FTP) is the most widely used file transfer protocol on the Internet.

  • FTP provides interactive access , allowing customers to specify the type and format of files (such as specifying whether to use ASCII code), and allowing files to have access rights (such as users accessing files must be authorized and enter a valid password).
  • FTP shields the details of each computer system and is therefore suitable for transferring files between any computers in heterogeneous networks.
  • User rights management allows users to manage files on the remote FTP server.
  • Provides public file sharing function through  anonymous FTP ( user ID is anonymous ) .

The FTP server process consists of two parts: a main process , responsible for receiving new requests; and several slave processes , responsible for processing individual requests.

The following two parallel TCP connections are established between the FTP client and server :

  • One is the control connection , which remains open during the entire session and is used to transmit FTP-related control commands.
  • The other is a data connection , which is used for file transfer. It is established every time a file is transferred and is closed after the transfer is completed. 

By default, FTP uses TCP port 21 for control connections and TCP port 20 for data connections.

However, whether to use TCP port 20 to establish a data connection is related to the transmission mode. The active mode uses TCP port 20, and the passive mode is decided by the server and client through negotiation.

The client uses port 20 by default to establish a data connection with the server (×) ← The port number of the client port is provided by the client process itself.

Guess you like

Origin blog.csdn.net/weixin_74059671/article/details/128433172