In a typically FTP session, the user is sitting in front of one host and wants to transfer files to or from a remote
host. In order for the user to access the remote account, the user must provide a user identification and a password.
After providing this authorization, the user cant transfer files from the local file system to the remote file system and
vice versa. The user interacts with FTP through an FTP user agent. The user first provides the hostname of the
remote host, causing the FTP client process in the local host to establish a TCP connection with the FTP server process in
the remote host. The user then provides the user identification and password, which get sent over the TCP connection
as part of FTP commands. Oncethe server has authorized the user, the user copies one or more files stored in the local
file system into the remote file system.
HTTP and FTP are both files transfer protocols and have many common characteristics; for example, they both run on top
of TCP.
The two application-layer protocols have some important differences. FTP uses two parallel TCP connections to transfer
a file, a control connection and a data connection. The control connection is used for sending
control information between the two hosts. The data connection is used to actually send a file. Because FTP uses
a separate control connection, FTP is said to send its control information out-of-band. When a user
starts an FTP session with a remote host, the client side of FTP first initiates a control TCP connection with the server
side on server port number 21. The client side of FTP sends the user identification and password over this control connection.
The client side of FTP sends also sends, over the side receives over the control connection a command for a file transfer,
the server side initiates a TCP data connection to the data connection.
Throughout a session, the FTP server must maintain state about the user. The server must
associate the control connection witha specific user account. and the server must keep track of the user's current directory
as the user wanders about the remote directory tree. Keeping track of this state information for each ongoing user serssion
signigicantly constrains the total number of sessions that FTP can maintain simultameously.