Throughout a session, the FTP server must maintain state about the user. The Server must
associate the control connection with a 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 user session, constrains the total number of session
that FTP can maintain simultaneously.
The commands from client to server and replies from server to client are sent across the
control connection in 7-bit ASCII format. Like HTTP commands, FTP commands are
readable by people. Each command consists of four uppercase ASCII characters, some with
optional arguments. Here are some of the more common commands:
USER username: Used to send the user identification to the server
PASS password: Used to send password to the server.
LIST: Used to ask the server to send back a list of all the files in the current remote directory. The list of files is sent over a data connection instead of the control TCP connection.
RETR filename: Used to retrieve a file from the current directory of the remote host. Triggers the remote host to initiate a data connection and send the requested file over the data connection.
STOR filename: Used to store a file into the current directory of the remote host.
There is typically a one to one correspondence between the command that the user issues
and FTP command sent across the control connection. Each command is followed by a reply,
sent from server to client. The replies are three-digit numbers with an optional message
following the number. This is similar to the status code structure and phrase in the status line
of the HTTP response message. |