FTP Protocol
In this tutorial, we will be covering the FTP of the Application layer of the OSI Model.
FTP means File Transfer Protocol and it is the standard mechanism provided by the TCP/IP in order to copy a file from one host to another.
-
File Transfer Protocol is a protocol present at the Application layer of the OSI Model.
-
FTP is one of the easier, simpler, and secure ways to exchange files over the Internet.
-
FTP is different from the other client/server applications as this protocol establishes two connections between the hosts.
-
where one connection is used for the data transfer and is known as a data connection.
-
while the other connection is used to control information like commands and responses and this connection is termed as control connection.
-
FTP is more efficient as there is the separation of commands.
-
The File Transfer Protocol makes the use of two protocols; Port 21 for the Control connection and Port 20 is used for Data connection.
-
The control connection in FTP makes the use of very simple rules of communication, we just need to transfer a line of command or a line of response at a time.
-
On the other hand, the data connection needs more complex rules; and the reason behind this is there are a variety of types of data that needs to be transferred.
-
The transferring of files from the client computer to the server is termed as "uploading", while the transferring of data from the server to the client computer is termed as "downloading".
-
The types of files transferred using the FTP are ASCII files, EBCDIC files, or image files.
Working of FTP
Given below figure shows the basic model of file Transfer Protocol, where the client comprises of three components: User Interface,Client control process, and client data transfer process. On the other hand, the server comprises of two components mainly the server control process and the server data transfer process.
-
Also, the control connection is made between the control processes while the data connection is made between the data transfer processes.
-
The control Connection remains connected during the entire interactive session of FTP while the data connection is opened and then closed for each file transferred.
-
In simple terms when a user starts the FTP connection then the control connection opens, while it is open the data connection can be opened and closed multiple times if several files need to be transferred.
Data Structure
Given below are three data structures supported by FTP:
1.File Structure
In the File data structure, the file is basically a continuous stream of bytes.
2.Record Structure
In the Record data structure, the file is simply divided into the form of records.
3.Page Structure
In the Page data structure, the file is divided into pages where each page has a page number and a page header. These pages can be stored and accessed either randomly or sequentially.
FTP Clients
It is basically software that is designed to transfer the files back-and-forth between a computer and a server over the Internet. The FTP client needs to be installed on your computer and can only be used with the live connection to the Internet.
Some of the commonly used FTP clients are Dreamweaver, FireFTP, and Filezilla.
Features of FTP
Following are the features offered by the File transfer protocol:
-
FTP is mainly used to transfer one file at a time.
-
Other actions performed by FTP are listing files, creating and deleting directories, deleting files, renaming files, and many more.
-
FTP also hides the details of individual computer systems.
-
FTP allows those files that have ownership and access restrictions.
-
It is a connection-oriented protocol.
-
FTP is a stateful protocol as in this the client establishes a control connection for the duration of an FTP session that typically spans multiple data transfers.
Transmission Modes
FTP can transfer a file across the data connection using one of the three given modes:
1.Stream Mode
Stream Mode is the default mode of transmission used by FTP. In this mode, the File is transmitted as a continuous stream of bytes to TCP.
If the data is simply in the form of the stream of bytes then there is no need for End-of-File, Closing of data connection by the sender is considered as EOF or end-of-file. If the data is divided into records (that is the record structure), each record has an I-byte of EOR(end-of-record).
2.Block Mode
Block mode is used to deliver the data from FTP to TCP in the form of blocks of data. Each block of data is preceded by 3 bytes of the header where the first byte represents the block descriptor while the second and third byte represents the size of the block.
3.Compressed Mode
In this mode, if the file to be transmitted is very big then the data can be compressed. This method is normally used in Run-length encoding. In the case of a text file, usually, spaces/blanks are removed. While in the case of the binary file, null characters are compressed.
Advantages of FTP
Following are some of the benefits of using File Transfer protocol:
-
Implementation of FTP is simple.
-
FTP provides one of the fastest ways to transfer files from one computer to another.
-
FTP is a standardized protocol and is widely used.
-
File Transfer protocol is more efficient as there is no need to complete all the operations in order to get the entire file,
Disadvantages of FTP
Let us take a look at the drawbacks of FTP:
-
File Transfer Protocol is not a secure way to transfer the data.
-
FTP does not allow the copy from server to server and also not allows removal operations for the recursive directory.
-
Scripting the jobs is hard using the FTP protocol.
-
The spoofing of the server can be done in order to send data to a random unknown port on any unauthorized computer