FTP Imp RC
FTP Imp RC
FTP Imp RC
Overview
File Transfer Protocol (RFC 959)
Promote sharing of files (programs and/or data) Encourage indirect/implicit use of remote computers Shield users from variations in file storage among hosts Transfer data reliably and efficiently
FTP
Operating Systems Character Sets Naming Conventions Directory Structures File Structures and Formats
problems
FTP
Server PI
Control
User PI
File System
Server DTP
Data
User DTP
File System
FTP
Control Connection
The control connection is the well known service. The control connection uses the TELNET protocol. Commands and replies are all line oriented text (default is ASCII).
FTP
FTPs Connections
client
User Interface
* Non-persistent Persistent command * Insulates users from raw data Server is listening on port 21 *Server uses FTP portcommands 20 * Routes raw and reply connection FTP commands for connection requests for data servers connections * connection Receives replies
server
Control Connection
FTPs
Connections Establishment
client Connected to cse.unr.edu 220 cse FTP server ready. 530 Please login with USER and PASS 331 Password req for mgunes. Password: 230 User mgunes logged in. ftp> USER PASS mgunes mypass server
User Interface
Control Connection
FTPs
User Interface
Control Connection
Passive open on Port 5001 User Data Data Transfer Connection Function Server Data Transfer Function
FTPs
User Interface
Control Connection
FTP Connections
FTP
12
Change local directory lcd Change remote directory cd Lists commands the server accepts rhelp / remotehelp * Sent to server as multiple command by User Protocol Interpreter
CDUP
QUIT
FTP
14
MODE
STRU
FTP
15
BLOCK:
file is transmitted as a series of blocks preceded by headers containing count and descriptor code (EOF, EOR, restart marker).
COMPRESSED:
uses a simple compression scheme - compressed blocks are transmitted.
FTP 16
Service Commands
RETR
retrieve file
STOR
STOU APPE ABOR PWD
send file
send file and save as unique send file and append abort prev. service command print working directory
LIST
17
FTP Replies
All replies are sent over control connection. Replies are a single line containing
3 digit status code (sent as 3 numeric chars). text message.
FTP
18
FTP
19
20
120
200
230
Command OK
User login OK
331
421 530 552
RFC 959
The RFC includes lots more information and many details including:
FTP
22
TFTP
25
RARP Server
TFTP
26
Diskless Workstation
TFTP
27
The dialog
here is part 1
I got part 1 TFTP Server
here is part 2
Diskless Workstation
boot file
TFTP
28
TFTP Protocol
5 message types:
Read request Write request Data ACK (acknowledgment) Error
Each is an independent UDP Datagram Each has a 2 byte opcode (1st 2 bytes) The structure of the rest of the datagram
TFTP
29
OPCODE
FILENAME
MODE DATA
ERROR MESSAGE
0
TFTP 30
no translation done.
all lines end with \r\n (CR,LF). provides standard format for transferring text files. both ends responsible for converting to/from netascii format.
TFTP
31
TFTP
32
Read Request
01 filename
null terminated ascii string containing name of file 2 byte opcode network byte order
mode
Write Request
02 filename
null terminated ascii string containing name of file 2 byte opcode network byte order
mode
TFTP
35
TFTP Acknowledgment
04
block #
TFTP
36
TFTP
37
TFTP
38
TFTP
39
TFTP Session
TFTP
40
TFTP
41
receive DATA[n] (dup) send ACK[n] (dup) receive DATA[n+1] send ACK[n+1] receive DATA[n+1] (dup) send ACK[n+1] (dup)
TFTP 42
The Fix
Sender should not resend a data packet in
TFTP
43
Concurrency
TFTP servers use a "well known address" (UDP
port number).
forking (alone) may lead to problems! Can provide concurrency without forking, but it requires lots of bookkeeping.
TFTP
44
TFTP Concurrency
According to the protocol, the server may
create a new udp port and send the initial response from this new port.
TFTP
45
When is it over?
There is no
of data!
TFTP
46
Issues
What if more than 65535 chunks are sent?
The RFC does not address this issue! Remember that the network can duplicate
packets!
TFTP
47
UDP
FTP uses two connections TFTP uses one connection (stop and wait)