Back to the 2026 paper

FTP

20267m

Describe the working of File Transfer Protocol (FTP) with a neat diagram. Describe the control connection and data connection used for file transfer.

Worked SolutionAI Assisted

File Transfer Protocol (FTP)

FTP is an application-layer protocol (RFC 959) for transferring files between a client and a server over TCP. It uses two separate connections.

SVGVector Architecture Diagram (SVG)
FTP Client FTP Server Control Process Control Process Data Transfer Data Transfer Control connection (port 21) Data connection (port 20) Local file system Remote file system

Control Connection

  • Uses server port 21; opened first and stays open for the whole session
  • Carries commands (USER, PASS, LIST, RETR, STOR, QUIT) and replies (status codes)
  • Text (NVT ASCII) based; handles login/authentication

Data Connection

  • Uses server port 20 (active mode)
  • Opened for each file transfer and closed afterward
  • Carries the actual file or directory listing

Modes

  • Active: server initiates the data connection to the client.
  • Passive: client initiates the data connection (works through firewalls/NAT).

Working

  1. Client opens the control connection to port 21 and logs in.
  2. Client sends a command (e.g. RETR file).
  3. A data connection is set up and the file is transferred.
  4. The data connection closes; the control connection remains for further commands until QUIT.

Using separate connections (out-of-band control) allows commands to be sent even during a transfer.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.