Class FTP file transfer mechanism

xiaoxiao2021-03-06  41

1. Open two ports on the server, one role is to listen to the command, and another one is used to transfer file data. 2, the client is connected to the server's listening port, send the test connection command, check if the server is running normally. If you transfer it normally, or terminate this dialogue or terminate or reconnect. 3, the server sends a confirmation information to the client through the command port, notifying the client service to run normally, and determine if some of the local settings can determine if the file can be sent to the client, if you can go to the next step, otherwise the reason for the error Send it to the client through the command port, stop the session, the client will process the corresponding processing by the received information, or terminate all the actions, or try again. 4, the server sends the port number of local open to transmit the file to the client, and then the client connects the port of the server through the socket, and the client is automatically randomly selects a port connection to the server. (Because in general, the port of the server should be fixed. And when using the socket connection, the port of the server is fixed, while the client's port is randomly selected during the connection. If the server is connected to the customer If the end, on the one hand, the server needs to develop too much port. The process of selecting the port is very troublesome; on the other hand, there will be a lot of restrictions on the client, need to be set according to different situations) 5, through the file transfer port Transfer files to the client. 6. When it is transferred, if it is a big file, it is generally to split it into a small piece to transmit, because the data is stored in memory during transmission, if it is entirely put it entirely In memory, it will soon cause overflow of memory. 7. You can also download a number of processes simultaneously downloaded. This time does not have problems with the same port, because there are many channels in the same port, each file transfer is completed through channels, mutual There will be no interference.

转载请注明原文地址:https://www.9cbs.com/read-56866.html

New Post(0)