Basic FTP File Transfer Protocol Mode

Source: Internet
Author: User
Tags ftp connection ftp file ftp file transfer ftp file transfer protocol

Today, we will introduce a protocol called FTP file transfer protocol. So it is an application in the norm TCP/IP. It is also one of the basic protocols for transmission. Now let's take a look at its basic concepts and connection modes.

1. FTP File Transfer Protocol Overview

FTP is short for File Transfer Protocol. FTP is a specific application of TCP/IP. It works on the Seventh Layer of the OSI model and the fourth layer of the TCP model, that is, the application layer uses TCP transmission instead of UDP. The FTP connection is reliable and connection-oriented, providing reliable guarantee for data transmission 。

The FTP working mode is similar to the Client/Server mode. Unlike most other TCP applications, FTP uses two TCP connections between the client and the server-control connections and data connections, the control connection exists throughout the process of customer-server interaction, and data connections are created only when files or directories are transmitted, the connection is closed after it is used up. The control connection is used to send commands to the server and wait for the server to respond. The data connection is used to establish a data transmission channel 。

2. Port mode of FTP File Transfer Protocol

Depending on whether the Port or Passive mode is used, FTP uses different TCP Port numbers 。

FTP Port Mode

The FTP File Transfer Protocol in Port mode is as follows:

1. The client sends a TCPSYN (TCP synchronization) packet to the well-known FTP control port 21 of the server segment, and the client uses the temporary port as its source port;

2. the server sends a syn ack (synchronous confirmation) packet to the client. The source port is 21 and the destination port is the temporary port used on the client;

3. The client sends an ACK packet. The client uses this connection to send FTP file transfer protocol commands, and the server uses this connection to send FTP responses;

4. When a user requests a List request or initiates a request to send or accept files, the client software uses the PORT command, which contains a temporary PORT, the client wants the server to use this temporary PORT when opening a data connection. The PORT command also contains an IP address, which is usually the customer's own IP address, in addition, FTP supports the third-party mode. In the third-party mode, the client tells the server to open a connection with another host;

5. the server sends a SYN packet to the temporary PORT of the client. The source PORT is 20, and the temporary PORT is the temporary PORT number sent from the client to the server in the PORT command;

6. The client uses the source port as the temporary port, and the destination port is 20 to send a syn ack packet;

7. The server sends an ACK packet;

8. The host sending data sends data through this connection, and the data is sent in the form of a TCP segment (Note: segment, layer 4th PDU) (some commands, for example, STOR indicates that the client needs to send data, and RETR indicates that the server sends data). These TCP segments must be ACK confirmed by the other party (Note: Because TCP is a connection-oriented Protocol );

9. After the data transmission is complete, the host sending the data end the data connection with a FIN command. The FIN Command needs to be confirmed by ACK on another host, another host also sends a FIN command, which also needs to send data to the host with ACK for confirmation;

10. The FTP File Transfer Protocol stipulates that after the client ends, the client uses the FIN command to close a control connection, and the server uses the ACK package to confirm the FIN of the client, the server also sends its FIN, and the client uses ACK for confirmation 。

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.