How FTP works

Source: Internet
Author: User
Tags ftp commands ftp client ftp protocol ftp transfer
How FTP works-Linux Enterprise Application-Linux server application information. See the following for details. The abbreviation of FTP Transfer Protocol is described in RFC 959.

An FTP session contains two channels: a control channel and a data channel.

Control CHannel: the control channel is used to communicate with the FTP server. The control channel is used to connect to FTP and send FTP commands.

Data Channel: data channel is a channel for file transfer or list with the FTP server.

In the FTP protocol, the control connection is initiated by a client, and the data connection works in two ways: PORT and PASV.

PORT mode (active mode)

The FTP client first establishes a connection with the tcp port 21 of the FTP Server and sends commands through this channel. When the client needs to receive data, it sends the PORT command through this channel. The PORT command contains the PORT used by the client (a PORT greater than 1024) to receive data. When transmitting data, the server sends data through its TCP port 20. The FTP server must establish a new connection with the client to transmit data.

PASV mode (passive mode)

The PORT mode is similar when a control channel is set up. When the client sends the PASV command through this channel, the FTP server opens a random port between port 1024 and port 5000 and notifies the client to send data requests on this port. Then, the FTP server transfers data through this port, at this time, the FTP server no longer needs to establish a new connection with the client to transfer data.

From the perspective of the C/S model, PORT is OUTBOUND for servers and PASV is INBOUND for servers. Pay special attention to this, especially in enterprises that use firewalls, this is critical. If an error is set, the customer will not be able to connect.
Related Article

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.