Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
1.1.
Control connection
1.2.
Data connection
2.
FTP session
2.1.
Data Structures
2.2.
FTP commands
2.3.
Features of FTP
2.4.
Advantages of FTP
2.5.
Disadvantages of FTP
3.
Frequently Asked Questions
3.1.
List all layers of the OSI model?
3.2.
Which are the protocols used in the Application layer?
3.3.
What is SMTP protocol?
3.4.
List most common network topologies?
4.
Conclusion
Last Updated: Mar 27, 2024

FTP (File Transfer Protocol)

Author Anant Dhakad
1 upvote
Computer Networks

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 Commands

FTP Replies

Given are a few of the FTP replies:

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.

Frequently Asked Questions

List all layers of the OSI model?

There are seven layers in the OSI model. They are:
1. Physical layer

2. Data link layer

3. Network layer

4. Transport layer

5. Session layer

6. Presentation layer

7. Application layer

Which are the protocols used in the Application layer?

Several protocols are used in the Application layer which include DNS, SMTP, POP, FTP, HTTP, etc.

What is SMTP protocol?

SMTP (Simple Mail Transfer Protocol) is an application layer protocol. It is used to send mails

List most common network topologies?

The most common network topologies are:
1. Mesh topology

2. Bus topology

3. Star topology

4. Ring topology

Conclusion

Cheers if you reached here!

In this article, we discussed the FTP (File transfer protocol), its features, advantages, and disadvantages.

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Live masterclass