FTP protocol Detailed

Source: Internet
Author: User
Tags ftp protocol

A protocol that requires multiple connections between a client and a server to complete an application is a complex protocol. Complex protocols such as ftp,pptp,h.323 and sip are entered.

This article mainly describes how the FTP protocol works. First, the FTP communication protocol has two modes of operation, passive mode and active mode.

    • Active mode

For example, assume that the client IP is 192.168.2.10, the server-side IP is 192.168.2.11, first the client uses port 1966 to connect to the server's 21 port, and then the client sends a message containing the port The 192,168,2,10,19,137 character of the packet to the server side.

After the server receives this packet, it is learned from the port 192,168,2,10,19,137 string that the client 192.168.2.10 (the first four paragraphs in the string) dynamically enabled a port 5001 on it (the last two paragraphs of the string 19*256+137= 5001), then the server side will be fixed using port 20 to connect to the client port 5001.

1955-21-Port connection for control connection, 20-5001-port connection for data connection

    • Passive mode

Assume that the client IP is 192.168.2.10, the server-side IP is 192.168.2.11, the client first uses port 1955 to connect to the server's 21 port, and then the client sends a packet containing the PASV command to the server side to the server, and the server receives the packet and knows that the client requires Passive (Passive) mode to transmit data, and then the server sends a packet containing the port 192,168,2,11,,114,134 string to the client.

After the client receives this packet, it is learned from the port 192,168,2,11,,114,134 string that the server-side 192.168.2.11 (the first 4 segments of the character) on which a port 29318 is dynamically opened (the last two paragraphs of the string 114*256+134= 29318), the client then uses another port 1956 to connect to port 29318 on the server side.

1955-21-Port connection for control connection, 1956-29318-port connection for data connection

FTP protocol Detailed

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.