Separate the control conversation from the file
01An FTP client sends commands on one TCP connection. The file travels on another connection, whose opening direction matters.
The client connects to the same server address on port 6446. A separately authorized RETR then sends download bytes in the opposite direction.
Key idea: Opening the data connection and sending the file are different directions.
Terms
- FTP
- File Transfer Protocol. Its control connection carries commands; a separate data connection carries a file or directory listing.
- Client / server
- The client sends FTP commands. Which side opens the data TCP connection is a separate choice.
- Address family
- The network protocol number: 1 for IPv4 and 2 for IPv6 in these examples.
- Passive mode
- The server listens for a data TCP connection that the connecting peer opens.
Rules & examples
Opening the data connection and sending the file are different directions.
- FTP uses a control connection and separate data connections. In the ordinary two-machine example, EPSV asks the server to listen; the client opens the data TCP connection.
- RFC 2428 §4 says EPSV MUST be used when control and data connections are between the same two machines. This is the usage rule of this extension, not a claim that every deployed legacy FTP server supports it.
- The 229 reply identifies a listening port, not a completed TCP handshake or a completed file transfer. A separately authorized RETR requests the illustrated download; FTP preliminary/final transfer replies are omitted.
- Here the client opens the data connection toward the server, while downloaded file bytes move from server to client. Connection initiation does not fix the file-transfer direction.
Documentation addresses and chosen listening ports. Each chapter is a separate bounded example; FTP authentication, authorization, file commands and transfer replies are not a complete FTP implementation here. EPRT/EPSV provide no encryption or guaranteed reachability.
Sources
New to this? Start hereA quick picture + helpful background
Commands arrange a separate file connection
Imagine arranging a delivery by phone, then opening a separate delivery entrance. EPSV asks the server to listen; EPRT can describe another receiving endpoint in a proxy setup. The analogy separates arranging a connection from moving the file and does not promise access through a firewall.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.