I'm trying to build a simple FTP server, but for the STOR command I'm not sure how to distinguish between the data connection closing because all the data was sent, or if the data connection closed prematurely.
In the RETR command, I know the size of the file I'm sending, but in the STOR command, I don't know how many bytes I should receive.
And if the data connection closes prematurely, what should the FTP server do?