Introduction
This blog will discuss the FTP (File transfer protocol) in the application layer. FTP (File Transfer Protocol) is an application layer protocol that allows you to transfer data between local and distant file systems. Similar to HTTP, it runs on top of TCP. FTP uses two TCP connections in parallel to transfer a file: a control connection and a data connection.
Control connection
FTP uses a control connection to communicate control information such as user identification, passwords, commands to update the remote directory, commands to receive and save files, etc. On port number 21, the control connection is established.
Data connection
FTP uses a data connection to send the real file. On port number 20, a data connection is established.
Because FTP uses a separate control connection, the control information is sent out-of-band. Some protocols send the data and the request and response header lines over the same TCP connection. Sending information over the same TCP connection is an in-band transfer of information. HTTP and SMTP are two examples of this.
Related Article Stop and Wait Protocol, Locked based protocol in DBMS
FTP session
When a client and server establish an FTP session, the client initiates a control TCP connection with the server. Over this, the client sends control information. When the server receives this information, it initiates a data connection with the client. Over a single data connection, just one file can be transmitted. The control connection, on the other hand, is kept active throughout the user session. HTTP is stateless, which means it does not need to keep track of any user state. However, FTP must keep track of its user's state during the session.
Data Structures
Three types of data structures are allowed over FTP.
1. File Structure: There is no internal structure in the file structure, and the file is handled as a continuous sequence of data bytes.
2. Record Structure: The file is made up of sequential records in a record structure.
3. Page Structure: The file is made up of independent indexed pages in page structure.
FTP commands
Given are a few of the FTP commands:
FTP Replies
Given are a few of the FTP replies:
Features of FTP
- FTP is primarily used to send a single file at a time.
- FTP can also list files, create and delete directories, delete files, rename files, and conduct a variety of other tasks.
- FTP also conceals the details of host systems.
- It is a connection-oriented protocol.
- FTP is a stateful protocol because, in this protocol, a control connection is initiated by the client for the life/duration of an FTP session, which usually spans numerous data transfers.
Advantages of FTP
- FTP is simple to implement.
- FTP is one of the most efficient methods for transferring files from one computer to another.
- FTP is a standard protocol and is used widely.
- FTP is more efficient since it eliminates the need to do all operations in order to obtain the entire file.
Disadvantages of FTP
- The File Transfer Protocol is not a secure method of data transfer.
- FTP has a file size limit. Only files up to 2 GB in size can be transferred.
- The FTP does not support multiple receivers.
-
The data is not encrypted when transferred through FTP.
You can also read about mime protocol.
You can read related articles such as Congestion Control in Computer Networks here.