Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 11
File Transfer Protocol
File Transfer Protocol
• File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another. • Differs from other client/server applications in that it establishes two connections between the hosts. One connection is used for data transfer, the other for control information (commands and responses). Communication over Control Connection • FTP uses the same approach as SMTP to communicate across the control connection. It uses the 7-bit ASCII character set. • Communication is achieved through commands and responses. 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 structure. • Each line is terminated with a two-character (carriage return and line feed) end-of-line token Communication over Data Connection • file transfer in FTP means one of three things: • o A file is to be copied from the server to the client. This is called retrieving aft/e. It is done under the supervision of the RETR command. • o A file is to be copied from the client to the server. This is called storing aft/e. It is done under the supervision of the STOR command. • o 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. File Type • FTP can transfer one of the following file types across the data connection: an ASCII file, EBCDIC file, or image file. • The ASCII file is the default format for transferring text files. Each character is encoded using 7-bit ASCII. The sender transforms the file from its own representation into ASCII characters, and the receiver transforms the ASCII characters to its own representation. • If one or both ends of the connection use EBCDIC encoding (the file format used by IBM), the file can be transferred using EBCDIC encoding. • The image file is the default format for transferring binary files. Data Structure • FTP can transfer a file across the data connection by using one of the following interpretations about the structure of the data: • file structure, record structure, and page structure. • In the file structure format, the file is a continuous stream of bytes. In the record structure, the file is divided into records. • This can be used only with text files. • In the page structure, the file is divided into pages, with each page having a page number and a page header. • The pages can be stored and accessed randomly or sequentially. Transmission Mode • FTP can transfer a file across the data connection by using one of the following three transmission modes: • stream mode, • block mode, and • compressed mode. • The stream mode is the default mode. Data are delivered from FTP to TCP as a continuous stream of bytes. • If the data are divided into records (record structure), each record will have a I-byte end of-record (EOR) character and the end of the file will have a I-byte end-of-file (EOF) character. In block mode, data can be delivered from FTP to TCP in blocks. In this case, each block is preceded by a 3-byte header. The first byte is called the block descriptor; the next 2 bytes define the size of the block in bytes. • In the compressed mode, if the file is big, the data can be compressed. The compression method normally used is run-length encoding. In a binary file, null characters are usually compressed