As shown in the following diagram, FTP uses separate command and data connections. The Protocol Interpreter (PI) implements the FTP protocol itself, while the Data Transfer Process (DTP) actually performs data transfer. The FTP protocol and the data transfer use entirely separate TCP sessions.
------------- |/---------\| || User || -------- ||Interface|<--->| User | |\----^----/| -------- ---------- | | | |/------\| FTP Commands |/----V----\| ||Server|<---------------->| User || || PI || FTP Replies || PI || |\--^---/| |\----^----/| | | | | | | -------- |/--V---\| Data |/----V----\| -------- | File |<--->|Server|<---------------->| User |<--->| File | |System| || DTP || Connection || DTP || |System| -------- |\------/| |\---------/| -------- ---------- ------------- Server-FTP USER-FTP NOTES: 1. The data connection may be used in either direction. 2. The data connection need not exist all of the time.
FTP servers listen on port 21. Data connections are initiated by the server from its port 20, to a port on the client identified in a PORT command.
For a discussion of running FTP through firewalls, see RFC 1579.