File Transfer Protocol (FTP) in Application Layer

File Transfer Protocol (FTP) in Application Layer (Full Explanation)

File Transfer Protocol (FTP) Poster

File Transfer Protocol (FTP) is an application layer protocol designed for transferring files between local devices, such as PCs and smartphones, and a server. It facilitates the transfer of both text and binary files over the Internet.

FTP establishes two connections between computers: one for commands and replies (the control connection) and another for data transfers (the data connection). This protocol operates on a client-server model architecture, utilizing both the control and data connections between the client and server.

Control Connection

A Control Connection is set up on Port number 21. This primary connection is responsible for sending commands back and forth between the client and server. It transmits control information, including user identification, passwords, and remote directories, once the control connection is established.

Data Connection

The Data Connection is initiated on Port number 20. Through the established Control Connection, the client and server create a separate Data Connection to transfer the requested data.

The Data Connection remains open until the transfer is complete, after which it is closed.

Either the client or the server can close Data Connections, depending on which party is sending the information. When a client retrieves data from a server, the server will close the connection once all data has been transferred. Conversely, when the client sends data to the server, the client will terminate the connection after the transfer is complete.

FTP transfers files in three distinct modes:

  • Stream mode: In this mode, FTP treats the data as a continuous stream of bytes without delineating boundaries.
  • Block mode: Here, FTP breaks down the entire data into various blocks.
  • Compressed mode: In this mode, FTP employs the Lempel-Ziv algorithm to compress the data.