Communication Networks · Visualized

FTP — File Transfer Protocol

Application Protocols

The protocols your apps speak directly: web, mail and file transfer — requests, responses and headers.

3 interactive subtopics — each one animated, step-through and explained.

FTP — File Transfer Protocol

Application Protocols

FTP moves files between client and server, but unlike HTTP it opens TWO connections: a control connection (commands and status codes, port 21) that stays open for the whole session, and a data connection (port 20 in active mode) opened fresh for each transfer and closed again. It authenticates with a username and password — or anonymously — and offers navigation, upload, download and directory listing.

How FTP — File Transfer Protocol Works

  1. Client connects to server port 21: this CONTROL channel carries USER/PASS login, CWD navigation, and RETR/STOR commands.
  2. For each file, a second DATA connection is created.
  3. Active mode: the server connects back to the client's announced port — fails behind NAT.
  4. Passive mode: the client connects out to a server-chosen port — NAT-friendly, the modern default.
  5. The file streams over the data channel; the control channel stays free for the next command.

FTP — File Transfer Protocol Worked Example

Try it: Play — log in, list a directory, download one file, and watch control vs data channels live and close.

The control line stays lit the whole session — commands flow as plain text with numeric replies (220 ready, 331 password, 226 transfer complete). The data channel blinks open only while the file crosses, then vanishes. Firewalls must expect this second, dynamic connection.

FTP clientyour machineFTP server:21 controlCONTROL — commands & replies (stays open)login over control: USER → 331 → PASS → 230 ✓
control channel (session) passive data (client connects out) active data (server connects in)
Stage 1 / 5
CONTROL channel opens: client → server port 21. Login: USER alice → 331 need password → PASS •••• → 230 logged in.

FTP — File Transfer Protocol: Key Facts to Remember

Two channelscontrol 21 (whole session) · data 20-active or negotiated-passive (per transfer)
NAT problemactive mode's inbound call breaks NAT/firewall — passive mode fixed it
SecurityFTP is plaintext — use FTPS (TLS) or SFTP (over SSH) for anything sensitive

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses

See how packets really travel

Networks are built on the structures and algorithms you can watch step by step — queues, trees, and routing algorithms.