background image
TCP/IP Protocols 233
FTP
FTP is a TCP-based application that has many options and features, including the capabilities
to change directories, list files using wildcard characters, transfer multiple files with a single
command, and use a variety of character sets or file formats. More important in this context is
the basic operation of FTP. Figures 5-15 and 5-16 show a typical FTP connection--or, better
stated, connections:
Figure 5-15
FTP Control Connections
The connection shown in Figure 5-15 is called an FTP control connection. When a user (FTP
client) asks to connect to an FTP server, a TCP connection is established to the FTP server's
well-known port (21). The connection is established like any other TCP connection. The user
is typically required to enter a user name and password, which the server uses to authenticate
the files available to that user for read and write permissions. This security is based on the file
security on the server's platform. Access to files on the client side is implied by the environment
from which the client created the FTP connection; again, this is dependent on the operating
system on the client platform. All the commands used to control the transfer of a file are sent
across this connection--hence the name FTP control connection.
At this point, the user has a variety of commands available to enable settings for transfer, change
directories, list files, and so forth. However whenever a get or a put command is entered (or
mget or mput--m is for multiple) or the equivalent button is clicked, then a file is transferred.
The data is transferred over a separate TCP data connection. Figure 5-16 outlines the FTP data
connection process.
Figure 5-16
FTP Data Connection
As shown in Figure 5-16, another TCP connection is established, this time to well-known port
20. Using this convention, a file can be transferred without getting in the way of the control
connection. If many files are to be transferred rather than make a single control/data connection
for each file, the control connection is made once. The environment is defined using the control
connection, and these settings affect the functioning of the data connection. For instance, the
default directory to use in future transfers can be defined using commands on the control
FTP Client
SYN, DPORT=21, SPORT=1030
FTP Server
SYN, ACK, DPORT=1030, SPORT=21
ACK, DPORT=21, SPORT=1030
FTP Client
get, myport=1031, file=zzz
FTP Server
TCP ACK
SYN, DPORT=20, SPORT=1031
SYN, ACK, DPORT=1031, SPORT=20
ACK, DPORT=20, SPORT=1031
ch05.fm Page 233 Monday, March 20, 2000 5:06 PM