You are on page 1of 12

File transfer protocol

introduction

• FTP is the standard mechanism provided by TCP/IP for copying a file


from one host to another.

• Transferring files from one computer to another is one of the most


common tasks expected from a networking or internetworking
environment.
FTP CONNECTIONS

• FTP differs from other client-server applications is that it establishes two


connections between hosts.
• One connection is used for data transfer, the
• Other for control information(commands and responses)
• Separation of commands and data transfer makes FTP more efficient.
• The control connection uses very simple rules of communication. We
need to transfer only a line of command or a line of response at a time.
• The data connection needs more complex rules due to variety of data
types transferred.
Basic model of ftp

USER

USER
INTERFACE CONTROL CONNECTION

CONTROL
CONTROL PROCESS
PROCESS
TCP/IP
DISK DATA DATA DISK
TRANSFER TRANSFER
PROCESS PROCESS

DATA CONNECTION
CLIENT SERVER
COMPONENTS OF FTP

• The client has three components:


• User interface
• Client control process
• Client data transfer process
• The server has two components:
• Server control process
• Server data transfer process
Control and data connection

• The control connection is made between the control processes


• The data connection is made between the data transfer processes
• The control connection remains connected during the entire interactive
FTP session.
• The data connection is opened and then closed for each file transferred.It
opens each time commands that involve transferring files are used, and it
closes when the file is transferred.
Active and passive mode

• FTP can be run in active or passive mode, which determine how the data
connection is established

• In active mode , the server initiates the TCP connection.

• In passive mode the client sends a PASV command to the server and
receives an IP address and port number in return. The client uses these
to open the data connection to the server.
Data representations

While transferring data over the network, four data representations can be used:
• ASCII mode: used for text. Data is converted, if needed, from the sending host's
character representation to "8-bit ASCII" before transmission, and (again, if
necessary) to the receiving host's character representation..

• Image mode (commonly called Binary mode): the sending machine sends each
file byte for byte, and the recipient stores the byte stream as it receives it.
(Image mode support has been recommended for all implementations of FTP).

• EBCDIC mode: use for plain text between hosts using the EBCDIC character set.
This mode is otherwise like ASCII mode.

• Local mode: Allows two computers with identical setups to send data in a
proprietary format without the need to convert it to ASCII
Data transfer modes

• Data transfer can be done in any of three modes:

• Stream mode:
→ Data is sent as a continuous stream.

• Block mode:
→ FTP breaks the data into several blocks (block header, byte
count, and data field) and then passes it on to TCP.

• Compressed mode:
→ Data is compressed using a single algorithm.
List of ftp commands

COMMANDS DESCRIPTION
ABOR Abort an active file transfer.

ACCT Account information.


Allocate sufficient disk space to receive a
ALLO
file.

DELE Delete file.

MKD Make directory.

NOOP
No operation
Specifies an address and port to which the
PORT
server should connect.

QUIT Disconnect.

REIN Re initializes the connection.

RNTO Rename to.

SIZE Return the size of a file.

STAT Returns the current status.


FTP REPLY CODES
The first digit of the reply code is used to indicate one of three possible outcomes,
• success,
• failure
• error or incomplete:
• 2xx - Success reply
• 4xx or 5xx - Failure Reply
• 1xx or 3xx - Error or Incomplete reply
The second digit defines the kind of error:
• x0z - Syntax - These replies refer to syntax errors.
• x1z - Information - Replies to requests for information.
• x2z - Connections - Replies referring to the control and data connections.
• x3z - Authentication and accounting - Replies for the login process and accounting
procedures.
• x5z - File system - These replies relay status codes from the server file system.
The third digit of the reply code is used to provide additional detail for each of the categories
defined by the second digit

You might also like