File Transfer Protocol (FTP): Control vs Data Connections and How FTP Works

File Transfer Protocol (FTP): Control vs Data Connections and How FTP Works

Verified Sources
Nov 4, 2026

File Transfer Protocol (FTP ) works by using two separate TCP connections between a client and server: a control connection for commands and replies, and a data connection for the actual file contents. This separation allows the client to exchange control information (e.g., login, directory listing commands) while the transfer itself happens over a distinct channel.

Below is a neat high-level diagram showing the typical behavior for a single file transfer where the client sends FTP commands on the control channel, and the server opens/receives a new connection for the data channel.

Key ideas

  • Control connection carries commands like USER, PASS, RETR, and reply codes like 150 and 226.
  • Data connection is created separately for each transfer (e.g., for RETR or STOR).
  • FTP uses a command-reply model on the control channel; the data channel exists only when a transfer is taking place.

Footnotes

  1. RFC 959: File Transfer Protocol (FTP) - Defines FTP operation including the separation of control and data connections and the command/reply model. ↩ ↩2 ↩3 ↩4

Working of FTP for a File Download (RETR)

  1. 1
    Step 1

    Client opens a TCP connection to the FTP server’s control port, and the server sends an initial greeting reply (e.g., code 220).

  2. 2
    Step 2

    Client sends USER and PASS commands over the control connection; server replies with status codes indicating whether the login is successful.

  3. 3
    Step 3

    Client and server determine how the data connection will be created (commonly by client sending PORT for active mode or requesting PASV for passive mode).

  4. 4
    Step 4

    Client sends RETR filename over the control connection.

  5. 5
    Step 5

    Server sends an intermediate reply (commonly 150-series) indicating the data connection is being opened/started.

  6. 6
    Step 6

    A new TCP connection is established specifically for the data transfer (this is distinct from the already-established control connection).

  7. 7
    Step 7

    Client and server exchange the file contents over the data connection until completion.

  8. 8
    Step 8

    Server sends a final completion reply over the control connection (commonly 226-series), and the data connection is closed for that transfer.

Control Connection in FTP

The control connection is the “signaling channel” for FTP. On this connection, FTP uses an ordered exchange of commands and numeric replies, allowing the server to report the state of the session and of transfers (e.g., permission checks, errors, and readiness).

Common properties:

  • It is established once per FTP session (typically client connects and stays connected during the session).
  • It carries:
    • FTP commands such as USER, PASS, RETR, STOR.
    • FTP reply codes that indicate progress and results.
  • It coordinates creation of the data connection, but does not carry file bytes.

Control connection lifecycle (conceptual)

Footnotes

  1. RFC 959: File Transfer Protocol (FTP) - Defines FTP operation including the separation of control and data connections and the command/reply model. ↩

Data Connection in FTP

The data connection is used only when transferring data such as file contents or directory listings. Unlike the control channel, the data connection is typically created per transfer (or at least per transaction), which enables the protocol to keep control signaling responsive while the bulk transfer happens.

Conceptually:

  • The control channel tells both sides a transfer is about to happen.
  • The data connection provides the bulk pipe for bytes.

Why separate connections?

Separating signaling from payload helps FTP remain structured:

  • Control messages (commands/replies) remain available during transfer coordination.
  • The bulk transfer uses a connection suited for streaming file bytes.

Footnotes

  1. RFC 959: File Transfer Protocol (FTP) - Defines FTP operation including the separation of control and data connections and the command/reply model. ↩

Active vs Passive Modes (How the data connection is created)

FTP must create a new TCP connection for the data channel. The method used depends on whether the client uses active or passive mode.

Active mode (high level)

  • Client tells the server where to connect for the data channel (e.g., via PORT command).
  • Server then connects back to the client’s indicated address/port to start the data transfer.

Passive mode (high level)

  • Client sends PASV and the server responds with an address/port where it is listening for data.
  • Client then connects to the server’s provided address/port for the data transfer.

Visual comparison

Footnotes

  1. RFC 959: File Transfer Protocol (FTP) - Defines FTP operation including the separation of control and data connections and the command/reply model. ↩ ↩2

Pro Tip

When you see 150 on the control connection, it usually means the server has started preparing/opening the data connection; the actual bytes begin on the data channel afterward.

Common Misconception

FTP does not send file contents on the control connection. File bytes always go over the separate data connection created for that transfer.

Control vs Data Connection Roles in FTP

Relative emphasis: commands/replies are control-channel; file bytes are data-channel.

Concept Checkpoints

FTP Transfer Timeline (Single RETR)

Control connection setup

T0

Client connects; server sends greeting."

Authentication / session commands

T1

Client sends login commands; server replies."

Data connection mode negotiation

T2

Client uses PORT (active) or PASV (passive)."

Transfer command

T3

Client issues RETR (download)."

Data channel established

T4

A new TCP connection is created for file bytes."

File bytes transferred

T5

Bulk data flows over the data connection."

Transfer completion

T6

Server sends completion reply on control connection."

Knowledge Check

Question 1 of 4
Q1Single choice

In FTP, where are file contents transferred during a RETR (download)?

File Transfer Protocol FTP: Control vs Data Connections and How FTP Works | AI Research | Coursify