File size 23.8 kB (23,784 bytes), it is sepolicy-update-2019.1-1.x86_64.rpm. The server has the address 126.96.36.199, the client behind NAT has the address 192.168.1.2.
We first observe the packets captured during the communication between the client and server that successfully transferring the file, using wireshark
The file sepolicy-update-2019.1-1.x86_64.rpm is uploaded to the FTP server in passive mode.
At the packet 55 the client send the PASV command to the server. In the next packet 56, the server returns port number 242 × 256 + 255 = 62207. It tells the client that it listens on that port and the client acknowledges.
In packet 61 the client sends the STOR command to the server to upload the file. After confirming the data connection, the client starts transferring data using the FTP-DATA protocol, and the server acknowledges the data received. The client sends 17 data packets 64 – 73, 75, 76, 78, 79, 81, 82 and 84, total 23,784 bytes of data (1408 × 15 + 1280 + 1384 = 23784). Then the server continuously acknowledges until it receives enough data and then notifies closing the connection (FIN) in packet number 92. The client acknowledges and the server returns code 226 – Transfer complete.
However, there is actually a situation where the upload speed is too high and therefore for the small file, the completion of the file transfer on client side happens too quickly, leading to the server not receiving enough data to close the connection and returning the error code when using FileZilla as below
Note that in this case we are transferring the file via TLS, so the packet information is not human readable. However, we still have the flag bits in the TCP header
The client transfers the file very quickly then continuously sending the signal RST (in the red) to finish but the server cannot respond by a [FIN, ACK] and file transfer failed.
To fix the problem we limit the upload speed on the client side. Go to the menu Transfer -> Speed limits -> Configure
You check “Enable speed limits” and then enter a small Upload limit value, such as 50. Now the upload is successful