Diagram: ftp client/server | FTP proto | TCP | IP | ...client - GUI, CLI, web browser
server - ftp daemon
FTP proto - commands and data for authentication, type of exchange, managing interation, exchanging filesSeparate control and data transfer connections are used.
Separate control and data connections (both built on TCP), usually two separate processes.
The control connection manages the interaction with the client. It remains in place.
The data connections are created and used as needed for each file transfer.
Server listens on port 21 for control connection requests.
To set up a data transfer connection, the server creates a socket on port 20, listening for connection from a specific port on the client. The client tells the server this port number when it makes the transfer request. This is a good example of a selective receive (by IP and port).
Many commands, most never used. Some handy:
get
put
prompt
mkdir
binary
cd
chmod
delete
lcd
ls
mget, mput
user
PORTResponses are 3 digits, followed by explanatory text (ignored by client and server but handy for humans).
USER
ABOR
Anonymous access, limited visibility of files.