0
3.9kviews
How the data gets transmitted from one host to another using FTP and TFTP.
1 Answer
0
34views

File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another.

FTP establishes two TCP connections between client and server.

One connection is used for data transfer [Port 20] other connection for control information (commands and responses) [Port 21]

Communication over Control Connection:

i. It uses the NVT ASCII character set (see Figure11).

ii. Communication is achieved through commands and responses.

iii. This simple method is adequate for the control connection because we send one command (or response) at a time. Each command or response is only one short line so we need not worry about file format or file.

enter image description here

Communication over data connection:

Client must define the type to be transferred, the structure of the data, and the transmission mode. Heterogeneity is solved by: file type, data structure, transmission mode.

enter image description here

FTP can transfer a file across the data connection by using one of following three transmission modes:

  • Stream mode: Data is delivered from FTP to TCP as a continuous stream of bytes. End-of-file is closing of data connection by sender. 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.
  • Block mode: Data can be delivered from FTP to TCP in blocks. Block is preceded by 3-byte header. 1st byte is called the block descriptor; next 2 bytes defines the size of block in bytes.
  • Compressed mode: If file is big, data can be compressed. Commonly used compression method is run-length encoding.

File Transfer:

File transfer occurs over the data connection under the control of the commands sent over the control connection. File transfer in FTP means one of three things (see Figure13).

a. A file is to be copied from the server to the client (download). This is called retrieving a file. It is done under the supervision of the RETR command.

b. A file is to be copied from the client to the server (upload). This is called storing a file. It is done under the supervision of the STOR command.

c. A list of directory or file names is to be sent from the server to the client. This is done under the supervision of the LIST command. Note that FTP treats a list of directory or file names as a file. It is sent over the data connection.

enter image description here

TFTP:

i. There are occasions when we need to simply copy a file without the need for all of the features of the FTP protocol.

ii. For example, when a diskless workstation or a router is booted, we need to download the bootstrap and configuration files.

iii. Trivial File Transfer Protocol (TFTP) is designed for these types of file transfer. It is so simple that the software package can fit into the read-only memory of a diskless workstation.

Connection:

i. TFTP uses UDP services. Because there is no provision for connection establishment and termination in UDP, UDP transfers each block of data encapsulated in an independent user datagram.

ii. In TFTP, however, we do not want to transfer only one block of data; we do not want to transfer the file as independent blocks either.

iii. We need connections for the blocks of data being transferred if they all belong to the same file.

iv. TFTP uses RRQ, WRQ, ACK, and ERROR messages to establish connection. It uses the DATA message with a block of data of fewer than 512 bytes (0–511) to terminate connection.

Connection Establishment:

Connection establishment for reading files is different from connection establishment for writing files (see Figure14).

enter image description here

  • Reading: To establish a connection for reading, the TFTP client sends the RRQ message. The name of the file and the transmission mode is defined in this message. If the server can transfer the file, it responds positively with a DATA message containing the first block of data. If there is a problem, the server responds negatively by sending an ERROR message.

  • Writing: To establish a connection for writing, the TFTP client uses the WRQ message. The name of the file and the transmission mode is defined in this message. If the server can accept a copy of the file, it responds positively with an ACK message using a value of 0 for the block number. If there is any problem, the server responds negatively by sending an ERROR message.

  • Connection Termination: After the entire file is transferred, the connection must be terminated. Termination is accomplished by sending the last block of data, which is less than 512 bytes.

    Data Transfer:

    i. The data transfer phase occurs between connection establishment and termination. TFTP uses the services of UDP, which is unreliable.

    ii. The file is divided into blocks of data, in which each block except the last one is exactly 512 bytes. The last block must be between 0 and 511 bytes.

    iii. TFTP can transfer data in ASCII or binary format. UDP does not have any mechanism for flow and error control. TFTP has to create a flow- and error-control mechanism to transfer a file made of continuous blocks of data.

Please log in to add an answer.