Data Communication & Networking Data Communication & Networking
Data Communication & Networking Data Communication & Networking
Data Communication & Networking Data Communication & Networking
&
Networking
Instructor:
Dr Ansar Munir Shah
FILE TRANSFER PROTOCOL
(FTP)
PRESENTATION BY: Group-1.
1)Ambreen Bushra MCS-023R18-4
2)Firdos Jamal MCS-023R18-5
3)Muniba Batool MCS-023R18-18
4)Sidra Fatima MCS-023R18-
19
What is FTP
The File Transfer Protocol (FTP) is a standard
network protocol used to transfer
computer files between a client and server on
a computer network.
become authenticated
User can explore the directories
file
FTP host downloads the file with error
3. Download
File Transfer Protocol (FTP)
User can also upload a file to the FTP Server
◦ WWW cannot do this
2. FTP Upload
FTP FEATURES
Interactive Access
FTP provides an interactive interface to allow
humans to interact with remote servers
Format Specification
FTP allows the client to specify the type and
representation of stored data.
The user can specify whether a file
contains text or binary data
FTP FEATURES
Authentication Control
FTP requires clients to authorize
themselves by sending a login name and
password to the server before requesting file
transfers.
The server refuses access to clients that
cannot provide a valid login and password.
FTP Model
The FTP models
Data
Connection.
Control
Connection.
PROTOCOL OVERVIEW
Block mode
o Data can be delivered from FTP to TCP in
blocks.
o Block is preceded by 3-byte header.
o 1st byte is called the block descriptor;
next 2 bytes defines the size of block in
bytes.
Transmission Modes
Compressed mode
o If file is big, data can be compressed.
o Commonly used compression method is run-
length encoding.
o Consecutive appearance of a data unit are
replaced by one occurrence and number of
repetitions. Usually, Blanks in text file and null
characters in binary file are compressed.
FTP Commands
USER R User name, user_id for access control
PASS O Password for access control
ACCT O Account info
CWD O Change working directory
CDUP O Change to parent directory
SMNT O Structure mount, mount a different file
system
QUIT R informs server that client wants out
REIN O restarts session at authentication phase
PORT R Host address and data port to use
FTP Commands (more)
PASV O Passive; informs server that client will
contact to set up data connections, ask
server to sent port info
TYPE R Data type, type of subsequent transfers
STRU R File structure
MODER Transfer mode
RETR R Retrieve, download the file from server
STOR R Store, upload the specified to server
STOU O Store unique, same as store but server
picks unique file name
FTP Commands (more)
APPE O Append, upload file to server, if file name
exists, append the upload
ALLO O Allocate, sometimes used to preallocate
space
REST O Restart, restart an interrupted transfer
RNFR O Rename file from filename
RNTO O Rename file to
ABOR O Abort, ask server to abort last command
DELE O Delete specified file
RMD O Remove directory
MKD O Make directory
FTP Commands (more)
PWD O Print working directory
LIST O Request directory listing
NLST O Request just a file name list
SITE O Site parameters, allow client to specify
site specific options and parameters
SYST O request server operating system
STAT O Request server to send status of current
xfr
HELP O general and command specific
NOOP R ask server to send a positive reply
FTP Responses
Each command generates a server response
◦ 3 digit code, text, <crlf>
use 3 digit code as driver for GUI Clients or
programmatic implementations
use text for Command line clients
Responses
1yz- Positive preliminary reply - command is being acted
upon; expect a final reply code before sending another
command
2yz- Positive completion reply - command was successfully
executed; new command may be sent
3yz - Positive intermediate reply - command was accepted,
but the final result is being delayed because other
information needs to be supplied from the client; reply is
used for sequencing command groups
4yz- Transient negative completion reply - command failed,
but the condition is temporary
5yz- Permanent negative completion reply – command
failed and will always fail if given again; the command
should not be attempted again
Response
x0z - Refers to command syntax
x1z - Indicates information returned by
commands requesting information such as status
or help
x2z - Refers to the state of the control or data
connections
x3z - The reply is associated with the login
process and accounting procedures
x4z - Reserved for future use
x5z - Refers to the state of the requested file
transfer or other file system command
A Simple FTP Transaction
Client connects to ftp server.
Server returns code 220 to specify that it is ready for the new
user
Client sends command “USER <username>”
Server returns code 331 if a password is required to access
the account.
Client sends command “PASS <password>”.
Server returns code 230 if authentication is successful.
Client sends a PORT command to specify the port number
that it wants to transfer data over.
Server returns code 200 if the PORT command was
successful.
Client sends a LIST command.
The server sends a list of files in the current directory and
returns code 226, which closes the connection.
A Simple FTP Transaction
Client sends another PORT command to open
another data connection.
Server returns code 200 if the PORT command is
successful.
The client sends a command of RETR <file name>
in order to initiate a transfer of that file.
Server returns code 150 is the file status is okay
and the file will be transferred. transferred.
When the transfer is complete, the server returns
code 226 to tell the client that the transfer is
complete and the data connection will be clossed.
Client sends QUIT command.
Server returns code 221 and closes the control
connection.
FTP Archiving
Many FTP files are archived
◦ Two-step process
◦ First, several files are combined into one archive
to avoid having to make multiple downloads
◦ Second, the combined files are compressed to
reduce download times
1. 2.
Combine Compress
FTP Archiving
Receiver must dearchive the files to read
them
Unfortunately, many archiving standards
Dearchive
FTP Archiving
Receiver must dearchive the files to read
them
Self- Dearchiving Files
Dearchive
FTP
THE END…