What is FTP Service? How to Use It?

Source: Internet
Author: User
Keywords what is ftp mean what is ftp server what is ftp client
1. What is the FTP protocol?
FTP (File Transfer Protocol) is one of the protocols in the TCP/IP protocol suite. The FTP protocol includes two components, one is the FTP server, and the other is the FTP client. The FTP server is used to store files, and users can use the FTP client to access resources located on the FTP server through the FTP protocol. When developing a website, the FTP protocol is usually used to transfer web pages or programs to a web server. In addition, due to the very high efficiency of FTP transmission, this protocol is generally used when transferring large files on the network.
Alibaba Cloud Simple Application Server:  Anti COVID-19 SME Enablement Program
$300 coupon package for all new SMEs and a $500 coupon for paying customers.

By default, the FTP protocol uses two TCP ports, 20 and 21, of which 20 is used to transmit data and 21 is used to transmit control information. However, whether or not to use 20 as the port for data transmission is related to the transmission mode used by FTP. If the active mode is adopted, the data transmission port is 20; if the passive mode is adopted, the final port to be used is determined by the server and the client through negotiation.

brief introduction:
Like most Internet servers, FTP is also a client/server system. The user connects to a server program running on a remote computer through a client program. Provide services in accordance with the FTP protocol. The computer that performs file transfer is the FTP server, and the computer that connects to the FTP server and transfers files to the server following the FTP protocol is the FTP client. To connect to the FTP server, users need to use FTP client software. Usually Windows comes with the "ftp" command, which is a command line FTP client program. In addition, commonly used FTP client programs include FileZilla, CuteFTP, Ws_FTP, Flashfxp, LeapFTP, meteor shower-cat's eye, etc.

2. User authorization
①, authorization
To connect to the FTP server (ie "log in"), you must have an account authorized by the FTP server, which means that you can log in to the FTP server only after you have a user ID and a password to enjoy the services provided by the FTP server

②, address format
FTP protocol FTP addresses are as follows:

ftp://username: password@FTP server IP or domain name: FTP command port/path/file name

The above parameters are not necessary except for the FTP server IP or domain name. For example, the following addresses are all valid FTP addresses:

ftp://foolish.6600.org

ftp://list:list@foolish.6600.org

ftp://list:list@foolish.6600.org:2003

ftp://list:list@foolish.6600.org:2003/soft/list.txt

③, anonymous
A large part of FTP servers on the Internet are called "Anonymous" FTP servers. The purpose of this type of server is to provide file copy services to the public, and does not require users to register with the server in advance, nor do they need to obtain the authorization of the FTP server

Anonymous (anonymous file transfer) enables users to establish a connection with a remote host and copy files from the remote host with an anonymous identity, instead of being a registered user of the remote host. Users log in to the FTP service with the special user name "anonymous", and then they can access public files on the remote host. Many systems require users to use the Emai1 address as a password in order to better track access. Anonymous FTP has always been the most important way to obtain information resources on the Internet. There are countless files stored in thousands of anonymous FTP hosts on the Internet. These files contain all kinds of information, data and software. As long as people know the host address of a specific information resource, they can use anonymous FTP login to obtain the information they need. Although the use of the WWW environment has replaced anonymous FTP as the main information query method, anonymous FTP is still a basic method for transferring and distributing software on the Internet. Anonymous sites of companies such as redhat and autodesk

3, transmission mode

The task of the FTP protocol is to transfer files from one computer to another. It has nothing to do with where the two computers are located, how they are connected, or even whether they use the same operating system. Assuming that two computers talk through the ftp protocol and can access the Internet, you can use FTP commands to transfer files. There are some subtle differences in the use of each operating system, but the basic command structure of each protocol is the same

There are two ways to transfer FTP: ASCII transfer mode and binary data transfer mode:

①, ASCII transmission
The FTP protocol assumes that the file that the user is copying contains simple ASCII text. If a different operating system is running on the remote machine, FTP will usually automatically adjust the content of the file when the file is transferred so that the file can be interpreted as another one. The format in which the computer stores text files. However, it is often the case that the files being transferred by the user are not text files. They may be programs, databases, word processing files or compressed files (although word processing files contain mostly text, they also contain an indication of page size , Non-printing characters of fonts and other information)

Before copying any non-text files, use the binary command to tell ftp to copy verbatim and do not process these files. This is also the binary transmission described below

②, binary transmission
In binary transmission, the order of the file is saved so that the original and copied ones correspond to each other bit by bit. Even a file containing a bit sequence on the destination machine is meaningless. For example, Macintosh transfers an executable file to the Windows system in binary mode. On the other party's system, the file cannot be executed.

If you transfer a binary file in ASCII mode, it will still be translated even if it is not needed. This will make the transfer slightly slower, and it will also corrupt the data and render the file unusable. (On most computers, the ASCII method generally assumes that the first significant bit of each character is meaningless, because ASCII character combinations do not use it. If you transfer a binary file, all the bits are important.) If you know these two The machines are the same, the binary method is valid for both text files and data files


4, working methods

FTP supports two modes, one is called Standard (that is, PORT mode, active mode), and the other is Passive (that is, PASV, passive mode). The standard FTP client sends the PORT command to the FTP server. Passive mode FTP client sends PASV command to FTPServer

The following describes the working principles of these two methods:

①、Port
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 PORT commands on this channel. The PORT command contains what port the client uses to receive data. When transmitting data, the server connects to the designated port of the client through its own TCP20 port to send data. The FTPserver must establish a new connection with the client to transmit data

②、Passive
The FTP protocol is similar to the Standard mode when establishing a control channel, but it is not a Port command that is sent after the connection is established, but a Pasv command. After the FTP server receives the Pasv command, it randomly opens a high-end port (port number greater than 1023, less than 65535) and notifies the client of the request to transmit data on this port. The client connects to this port of the FTP server, and then the FTP server will pass this port For data transfer, at this time FTPserver no longer needs to establish a new connection with the client

Note: Many firewalls are not allowed to accept externally initiated connections when they are set up, so many FTP servers behind the firewall or intranet do not support PASV mode, because the client cannot pass through the firewall to open the high-end port of the FTP server; and Many clients on the internal network cannot log in to the FTP server in PORT mode, because the TCP20 of the slave server cannot establish a new connection with the client on the internal network, causing it to fail

5, exchange agreement
The simple point of FXP is that one FTP client controls two FTP servers and transfers files between the two FTP servers. The full name of FXP is the (FileExchangeProtocol) file exchange protocol. It can be considered that FXP itself is actually a subset of FTP, because the FXP method actually uses the Proxy command of the FTP server, but its prerequisite is that the FTP server supports PASV, and Support FXP mode

During FXP transmission, the file is not downloaded to the local, but only control commands are sent locally. Therefore, the speed of FXP transmission is only related to the network speed between the two FTP servers, not the local speed. Because the FXP method only sends commands locally, after the start of the transmission, as long as the local does not send the stop command, even if the local is shut down, the FXP is still transmitting. Until a file transmission is completed or a file transmission error occurs, the FTP server waits for the local to send the command , The FXP transmission will be terminated because the command cannot be received

Note: For the above reasons, when the FXP transmission error occurs, the local user process remains in the FTP server and does not exit. If you connect to the FTP server again at this time, the FTP server may prompt that the client has logged in and refuses because the user thread exceeds the permission. The connection of the client can not connect to the FTP server again until the puppet process in the server is killed by the FTP server due to timeout or other reasons

There are two necessary conditions for successful FXP: ① Both FTP servers support FXP; ② Both FTP servers support PASV. But it does not mean that the FTP servers that meet these two conditions are successfully FXP operated locally. This is also related to the local network conditions of the FTP server. So sometimes there will be the same two FTP, others can FXP, but you can not
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.