FTP connection mode (active mode passive mode)


FTP are two modes of transmission, active and passive modes,
a complete FTP file transfer need to create two types of connections, one for the next file transfer command, called the control connection, another true file transmission, called a data connection.

 

1. The control connection
when the client wishes to establish upload and download to the FTP server of the data transmission, it first initiates a TCP server port 21 requests an establishment of a connection, FTP server accepts requests from the client to complete establishment of the connection, such a connection It called FTP control connection.

 

2. The data connection
FTP control connection is established, the file transfer can begin, transfer files referred FTP data connection. Process FTP is an FTP data connection for transmitting data, which has two transmission modes

 

Connection process PORT (active) mode are:

FTP client to the server port (default 21) transmits a connection request, the server accepts the connection, establishing a link command. When you need to transfer data, the client tells the server on the command link with the PORT command: "I opened the XXXX port, you connect me to come." Thus XXXX server port 20 from the port sends a connection request to the client to establish a data link to transmit data.

 

PASV (passive) connection process approach are:

FTP client to the server port (default 21) transmits a connection request, the server accepts the connection, establishing a link command. When you need to transfer data, the server on the command link tells the client to use PASV command: "I opened the XXXX port, you connect me to come." Thus the client request sent to the port connection XXXX server, establishing a data link to transmit data.


Active FTP:
  command to connect: Client> 1023 Port -> Server port 21
  the data connection: Client> 1023 Port <- server port 20

Passive FTP:
  command connection: client> 1023 port -> server port 21
  Data connection: client> 1023 port -> Server> 1023 port

 

Guess you like

Origin www.cnblogs.com/guorongtao/p/11249457.html