0% found this document useful (0 votes)
201 views

Data Communication & Networking Data Communication & Networking

The document discusses the File Transfer Protocol (FTP). FTP allows users to transfer files between a client and server on a computer network. It uses separate connections for control commands and data transfer. The document outlines FTP features like authentication, interactive access, and format specification. It also describes the FTP model, command syntax, common commands, transmission modes, and response codes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views

Data Communication & Networking Data Communication & Networking

The document discusses the File Transfer Protocol (FTP). FTP allows users to transfer files between a client and server on a computer network. It uses separate connections for control commands and data transfer. The document outlines FTP features like authentication, interactive access, and format specification. It also describes the FTP model, command syntax, common commands, transmission modes, and response codes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Data Communication

&
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.

 It is built on client-server model architecture


and uses a separate control and data
connections between the client and the server
which operates under the application layer of
the Open System Interconnection (OSI) model.
USAGE OF FTP

Client connects to the FTP server


User provides a login id and password to

become authenticated
User can explore the directories

User can download files from and upload

files to the server


File Transfer Protocol (FTP)

 Client logs into host


 FTP host stores files

 Client program sends command to get a

file
 FTP host downloads the file with error

correction FTP Host


1. Login
2. FTP Get Command

3. Download
File Transfer Protocol (FTP)
 User can also upload a file to the FTP Server
◦ WWW cannot do this

1. Login FTP Host

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

 FTP may run in active or


passive mode, which
determines how the data
connection is established.
 In both cases, the client
creates a TCP control
connection from a
random, usually an
unprivileged, port N to
the FTP server command
port 21.
PROTOCOL OVERVIEW (CONT’D)
 In an Active FTP connection, the client opens
a port and listens and the server actively
connects to it. 
 In a Passive FTP connection, the server opens

a port and listens (passively) and the client


connects to it. 
 You must grant Auto FTP Manager Access to

the Internet and to choose the right type of


FTP Connection Mode.
File Transfer Protocol (FTP)
 Must Log into FTP Host Before Transfers
 Traditional FTP

◦ You log into a specific account with a password


◦ You can transfer to and from directories
accessible to that account
 Anonymous FTP
◦ You log in as “anonymous”
◦ Give your e-mail address as password (usually
optional)
◦ Host gives you access to public directories
◦ Usually for downloading only
◦ Not truly anonymous: your internet address is
known
SYNTAX
 FTP URL syntax is described in RFC 1738,
taking the form:
ftp://[user[:password]@]host[:port]/url-path
(the bracketed parts are optional).
File Structures

 Operating System store files in different structures


 FTP defined file structures for transporting files
◦ File F Unstructured, sequence of bytes
◦ Record R Series of records
◦ Page P Series of data blocks (pages)
 Default file structure is File (F)
 File Structure specified using STRU command
Transfer Files in a Heterogeneous Host
Environment
 Due to multiple hardware types and operating
systems file are converted to four environmentally
neutral data type for transport and the converted to
local types at the destination
◦ ASCII A NVT-ASCII
◦ EBCDICE EBCDIC Text
◦ IMAGE I Raw binary, series of octets
◦ LOCAL L Raw binary using a variable byte size
 Client responsibility to tell server data type to use
 Default data type, unless otherwise specified is
ASCII
FTP File Format Standards
 There are no standards for FTP file formats
◦ Nothing like HTML
◦ No limit on generality
◦ No help in handling after downloads
◦ You must know the file structure of the file you
download
◦ You must have an application program that can
read that file format
FTP File Format Standards
 FTP can transfer a file across the data connection using
one of the following interpretations about structure of
data:
o File structure (default)
 File has no structure.
 Continuous stream of bytes
o Record structure
 File is divided into records (or structs in C).
 Used only with text files.
o Page structure
 Pages can be stored or accessed randomly or
sequentially.
 File is divided into pages, with each page having a
page number and a page header.
Transmission Modes
 Mode is used to specify additional coding or
sequencing performed on data
 independent of data type and file structure
o Stream S stream of bytes, if record structure
EOF sent as record indication; if file eof
indicated by closing stream
o Block B file sent as sequence of blocks
preceded by header info allows restart of an
interruped transfer
o Compressed C data compressed using run length
encoding
Transmission Modes
Stream mode
o Default mode
o Data is delivered from FTP to TCP as a
continuous stream of bytes; TCP is responsible
for chopping data into segments of appropriate
size.
o End-of-file is closing of data connection by
sender.
o If data is divided into records, each record will
have 1-byte end-of-record (EOR) character, and
the end of the file will have a 1-byte end-of-file
(EOF) character
Transmission Modes

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

◦ Zip is the most common


◦ UNIX users tend to use others (tar)
◦ Some dearchiving programs handle only one
archiving standards, others several

Dearchive
FTP Archiving
 Receiver must dearchive the files to read
them
 Self- Dearchiving Files

◦ Usually, you need a dearchiving program to


dearchive
◦ However, some archives have the extension .exe
◦ Really programs; Dearchive themselves
◦ Executing the archive file dearchives its files
◦ These are programs, so be wary of viruses!

Dearchive
FTP
THE END…

You might also like