FTP: Control vs Data Connections, and Supported File Types
File Transfer Protocol (FTP ) uses two distinct TCP connections during a transfer: a control connection and a data connection.
Control connection (typically TCP/21)
The client uses the control channel to:
- authenticate and negotiate options (e.g., user/login and session parameters)
- send FTP commands such as
LIST,RETR,STOR,TYPE, and mode-setting commands - receive reply codes that confirm success/failure and report status
Data connection (separate TCP session per transfer)
When the client wants to transfer actual bytes (like listing files or downloading/uploading), FTP opens (or uses) the data connection. Over the data channel, FTP sends/receives:
- file contents for upload/download (STOR / RETR )
- directory listings (e.g.,
LIST) - protocol-specific data depending on the transfer mode (active vs passive )
A common mental model is:
- Control connection = “talk and agree”
- Data connection = “move the bytes”
Mermaid view of the two-channel relationship:
FTP (File Transfer Protocol) Basics: Control vs Data Connection
FTP transfer types: what kinds of file types can FTP transfer?
FTP is designed to transfer arbitrary files as sequences of bytes, but it can also describe how those bytes should be interpreted/encoded depending on the selected transfer type.
At a high level, FTP supports:
- ASCII (text) transfer type
Used for text where FTP performs translation (notably line-ending conventions) between client and server expectations. - Image (binary) transfer type
Used for files treated as raw bytes (no text translation). This is the appropriate choice for executables, archives, images, PDFs, etc.
In practice, this means FTP can transfer (examples):
- Plain text files (source code, configuration files)
- Log files and documents in text formats
- Binary files such as:
- images (e.g., JPEG/PNG)
- archives (e.g., ZIP/TAR)
- executables
- audio/video containers
- PDFs and other binary document formats
Because binary transfers use “no translation,” the “image”/binary mode preserves exact byte content rather than attempting text normalization.
Key idea: FTP can transfer both text and binary—the crucial difference is whether FTP applies character/line transformations or not.
How an FTP file download typically uses both connections
- 1Step 1
The client connects to the server’s control port (commonly TCP/21) and begins an FTP session.
- 2Step 2
The client issues login and session commands over the control channel and receives status replies.
- 3Step 3
The client selects a transfer type such as ASCII for text or image/binary for raw bytes (to avoid unwanted transformations).
- 4Step 4
The client sends a command like RETR on the control channel and waits for the server’s reply indicating the data transfer is ready.
- 5Step 5
FTP then establishes a separate TCP connection for the actual data stream (active or passive mode).
- 6Step 6
The server sends the file contents as a byte stream on the data channel until completion.
- 7Step 7
After the data transfer ends, the server reports completion status via the control channel.
Visual summary of responsibilities
Keywords to remember
- control connection
- data connection
- transfer type
- active mode
- passive mode
Choose the right transfer type (text vs binary)
When downloading source/config files, ASCII/text mode can be convenient; for images, archives, executables, and PDFs, use binary/image mode to avoid line/character translations.
FTP ‘two-connection’ behavior affects firewalls/NAT
Because the data connection is separate from the control connection, FTP in active/passive modes can behave differently behind NAT/firewalls; passive mode is often required in restrictive network environments.
Which FTP connection does what?
A quick comparison between control vs data responsibilities.
Typical FTP session flow (high level)
Connect (control)
1Client creates the control TCP session and starts the FTP dialog."
Negotiate
2Client sets transfer type (ASCII vs binary/image) and other parameters."
Request a transfer
3Client issues commands like RETR (download) or STOR (upload) over control."
Open data channel
4A separate TCP data connection carries the file/listing contents."
Complete + report
5Client receives completion status on the control channel."
Common exam-focused clarifications
Quick self-test: FTP connections & transfer types
Knowledge Check
In FTP, which connection is primarily used to send FTP commands and receive server replies?