CHAPTER 19
File Transfer: FTP and TFTP
Exercises 1. If the control connection is accidentally severed during an FTP transfer, there would be no problem until the data transfer completed and the client attempted to send another command. 3. There should be limitations on anonymous FTP because it is unwise to grant the public complete access to a system. If the commands that an anonymous user could use were not limited, that user could do great damage to the file system (e.g., erase it completely). 5. See Figure 19.1. Figure 19.1 Exercise 5
5
Ephemeral port number 21 Sequence number Acknowledgment number Reserved Flags Window size Checksum Urgent Pointer "C" "O" "M" "M" "A" "N" "D" "" "a" "r" "g" "u" "m" "e" "n" "t" "s" CR LF
7. See Figure 19.2.
1
SECTION
Figure 19.2 Exercise 7
5
Ephemeral port number 20 Sequence number Acknowledgment number Reserved Flags Window size Checksum Urgent Pointer DATA
9. See Figure 19.3. Figure 19.3 Exercise 9
Client
Server 220 (Service ready) USER forouzan 331 (User name OK. Password?) PASS xxxx 230 (User login OK) PASV
Active open
227 (Entering passive mode, socket) LIST /usr/user/reports 125 (Data connection OK) DATA TRANSFER 226 (Closing data connection) QUIT 221 (Service closing)
11. See Figure 19.4.
13. See Figure 19.5
Passive open
2
SECTION
Figure 19.4 Exercise 11
Client
Server 220 (Service ready) USER forouzan 331 (User name OK. Password?) PASS xxxx
Passive open
230 (User login OK) PORT 1267 150 (Data connection will open)
Active open
RETR/usr/user/report 250 (Requested file action OK) DATA TRANSFER 226 (Closing data connection) QUIT 221 (Service closing)
Figure 19.5 Exercise 13
Client
Server 220 (Service ready) USER forouzan 331 (User name OK. Password?) PASS xxxx 230 (User login OK) NOOP 211 (System status or help) QUIT 221 (Service closing)
15. See Figure 19.6.
17. See Figure 19.7.
3
SECTION
4
Figure 19.6 Exercise 15
Client
Server 220 (Service ready) USER forouzan 331 (User name OK. Password?) PASS xxxx 230 (User login OK) MKD /usr/user/letters/Jan 200 (Command OK)
Figure 19.7 Exercise 17
Client
Server 220 (Service ready) USER forouzan 331 (User name OK. Password?) PASS xxxx 230 (User login OK) PWD 212 (Status) /usr/user/forouzan RNFR /usr/usrs/report/file1 200 (Command OK) RNTO /usr/usrs/letters/file1 200 (Command OK)
19. TFTP needs to use RRQ and WRQ messages for connection establishment and to let the server know what kind of service is required. These functions are served by various commands in FTP using the FTP control connection.
21. See Figure 19.8. The user datagram is 26 bytes.
SECTION
Figure 19.8 Exercise 21
Ephemeral port number 26 2 "p" 0 "a"
"o" "n" "s"
"i"
0
69 Checksum "R" "r" "e"
"e" "t " "t"
"c"
"i"
23. See Figure 19.9. Figure 19.9 Exercise 23 Host A
Host B
file1 1
ascii 3
1 3
4 Block 2 512 bytes
2 2
3
Block 1 512 bytes
1
4 Block 3 512 bytes
3
3 ACK 4 3
4 3
4 Block 5 102 bytes
5 5
25. See Figure 19.10.
Block 4 512 bytes
4
4
5
SECTION
Figure 19.10 Exercise 25 Host A
Host B Resent ascii 3
Block 1 512 bytes
1 1
Damaged
file1 1
4
3
2
Block 2 512 bytes
3
2
Block 2 512 bytes
3
3
Timeout 2
4 Block 3 512 bytes
3 ACK 4 3
4 3
Block 4 512 bytes
4 4
Block 5 102 bytes
5 5
4
6