TCP/IP Applications
FTP and TFTP
1
K. PALANIVEL
Systems Analyst, Computer Centre
Pondicherry University, Puducherry – 605014.
McGraw-Hill ©TheMcGraw-HillCompanies,Inc., 2000
TCP/IPAPPLICATION PROTOCOLS
FTP and TFTP
K. PALANIVEL
Systems Analyst, Computer Centre
Pondicherry University, Puducherry – 605014.
COMS 525: TCPIPLECTURE 12
TOPIC
COURSE
3
File Transfer:
FTP and TFTP
4
 FTP is the standard mechanism provided by TCP/IP for
copying a file from one host to another.
 Although transferring files from one system to another
seems simple and straightforward, some problems must
be dealt with first.
 For example, two systems may use different file
name conventions.
 Two systems may have different ways to represent
text and data.
 Two systems may have different directory structures.
 All of these problems have been solved by FTP in a
very simple and elegant approach.
File Transfer Protocol (FTP): Introduction
TCP/IPProtocolSuite
5
 FTP uses the services of TCP.
It needs two TCP connections.
 The well-known port 21 is used for the control
connection and the well-known port 20 for the data
connection.
TCP/IPProtocolSuite
6
FTP: In Action
Figure 1.1
7
Control Connection: Open
Figure 1.2
8
Data Connection: Creation
Figure 1.3
9
Using the control connection
Figure 1.4
10
Using the data connection
Figure 1.5
11
Command Processing
Figure 1.6
12
Figure 1.7
FTP: Access Commands
13
Figure 1.8
FTP: File Management Commands
Figure 1.9
FTP: Data Formatting Commands
FTP: Port Defining Commands
Figure 1.10
15
Figure 1.11
FTP: File Transfer Commands
FTP: Miscellaneous Commands Figure 1.12
16
Figure 1.13
FTP: Responses
17
Figure 1.14
FTP: Responses
18
Figure 1.14
File Transfer
220 (Service ready)
USER forouzan
LIST /usr/user/forouzan/reports
PASS xxxxxx
125 (Data connection OK)
331 (User name OK. Password?)
PORT 8888
150 (Data connection opens shortly)
230 (User login OK)
1
2
3
4
5
6
7
8
9
List of files or directories
List of files or directories
10
11
QUIT
226 (Closing data connection)
221 (Service closing)
12
13
14
DATA
TRANSFER
Figure 1.15
Retrieving a list of items in a directory.
20
 The colored lines show the responses from the server control
connection; the black lines show the commands sent by the
client.
 The lines in white with black background show data transfer.
Figure 1.15
Retrieving a list of items in a directory.
220 (Service ready)
USER forouzan
TYPE EBCDIC
STRU R
STOR/usr/user/forouzan/reports/file1
PASS xxxxxx
200 (OK)
200 (OK)
250 (OK)
331 (User name OK. Password?)
PORT 1267
150 (Data connection opens shortly)
230 (User login OK)
1
2
3
4
5
6
7
8
9
10
11
12
13
DATA
TRANSFER
Records of file ..........
Records of file ..........15
14
QUIT
226 (Closing data connection)
221 (Service closing)
16
17
18
Figure 1.16
How an image (binary) file is stored.
22
Assume that some public data are available at
internic.net.
Figure 1.16
Anonymous FTP
23
 There are occasions when we need to simply copy a
file without the need for all of the features of the
FTP protocol.
 For example, when a diskless workstation or a router
is booted, we need to download the bootstrap and
configuration files.
 Here we do not need all of the sophistication
provided in FTP.
 We just need a protocol that quickly copies the files.
TFTP
24
TFTP uses the services of UDP on the well-
known port 69.
25
Connection establishment
Figure 1.17
UDP Port Numbers used by TFTP
Figure 1.18
TFTP Example
Figure 1.19
28
1
2
3
4
5
Use of TFTP with DHCP
Figure 1.20
QUESTIONS ???

13 coms 525 tcpip - applications - file transfer protocol