FTP Protocol
In this tutorial, we are going to see What is the FTP Protocol? The File Transfer Protocol (FTP) is, like its name suggests, a file transfer protocol.
FTP was first implemented in 1971 when a mechanism for transferring files (described in RFC 141) between machines at MIT (Massachusetts Institute of Technology) was developed. Numerous RFCs have subsequently made improvements to the basic protocol, but the most significant innovations date from July 1973.
FTP Protocol
The FTP protocol defines the way in which data is to be transferred over a TCP/IP network.
The goals of the FTP protocol are to :
- Allow file sharing between remote machines
- Allow filesystem independence between client and server machines
- Allow to transfer data in an efficient way
FTP Model
The FTP protocol is part of the client-server model, i.e. one machine sends orders (the client), and the other waits for requests to perform actions (the server).
During an FTP connection, two transmission channels are open:
- A channel for commands (control channel)
- A channel for data
Image source: www.wikimedia.org
So, both the client and the server have two processes to manage these two types of information:
- DTP (Data Transfer Process) is the process responsible for establishing the connection and managing the data channel. The DTP on the server-side is called SERVER-DTP, the DTP on the client-side is called USER-DTP
- PI (Protocol Interpreter) is the protocol interpreter that allows the DTP to be controlled using the commands received on the control channel. It is different on the client and on the server:
- The SERVER-PI is responsible for listening to the commands coming from a USER-PI on the control channel on a given port, establishing the connection for the control channel, receiving on it the FTP commands from the USER-PI, answering them and driving the SERVER-DTP
- The USER-PI is responsible for establishing the connection with the FTP server, sending FTP commands, receiving responses from the SERVER-PI and controlling the USER-DTP if necessary
Image source: www.wikimedia.org
When connecting an FTP client to an FTP server, the USER-PI initiates the connection to the server using the Telnet protocol. The client sends FTP commands to the server, the server interprets them, drives its DTP, and then returns a standard response. When the connection is established, the server-PI gives the port on which the data will be sent to the DTP Client. The DTP Client then listens to the specified port for data from the server.
It is important to note that since the control and data ports are separate channels, it is possible to send commands from one machine and receive data on another. Thus, for example, it is possible to transfer data between two FTP servers by using a client to send control commands and transferring the information between two server processes connected to the correct port.
In this configuration, the protocol requires that the control channels remain open during the entire data transfer. Thus a server can stop transmission if the control channel is cut during the transmission.