Header Ads Widget

File Transfer Protocol (FTP) in Application Layer

File Transfer Protocol(FTP) is an application layer protocol which moves files between local and remote file systems. It runs on the top of TCP, like HTTP. To transfer a file, 2 TCP connections are used by FTP in parallel: control connection and data connection.

What is control connection?
For sending control information like user identification, password, commands to change the remote directory, commands to retrieve and store files, etc., FTP makes use of control connection. The control connection is initiated on port number 21.

What is data connection?
For sending the actual file, FTP makes use of data connection. A data connection is initiated on port number 20.
FTP sends the control information out-of-band as it uses a separate control connection. Some protocols send their request and response header lines and the data in the same TCP connection. For this reason, they are said to send their control information in-band. HTTP and SMTP are such examples.


FTP Session :
When a FTP session is started between a client and a server, the client initiates a control TCP connection with the server side. The client sends control information over this. When the server receives this, it initiates a data connection to the client side. Only one file can be sent over one data connection. But the control connection remains active throughout the user session. As we know HTTP is stateless i.e. it does not have to keep track of any user state. But FTP needs to maintain a state about its user throughout the session.

Data Structures : FTP allows three types of data structures :

  1. File Structure – In file-structure there is no internal structure and the file is considered to be a continuous sequence of data bytes.
  2. Record Structure – In record-structure the file is made up of sequential records.
  3. Page Structure – In page-structure the file is made up of independent indexed pages.

Trivial File Transfer Protocol (TFTP):

    It is also file transfer protocol without sophisticated features of FTP.
  • It is good for simple file transfers, such as during boot time.
  • It uses UDP as transport layer protocols. Errors in the transmission (lost packets, checksum errors) must be handled by the TFTP server.
  • It uses only one connection through well known port 69.
  • TFTP uses a simple lock-step protocol (each data packet needs to be acknowledged). Thus the throughput is limited

Anonymous FTP :
Anonymous FTP is enabled on some sites whose files are available for public access. A user can access these files without having any username or password. Instead, the username is set to anonymous and password to the guest by default. Here, user access is very limited. For example, the user can be allowed to copy the files but not to navigate through directories.

Post a Comment

0 Comments