Dynamic C, FTP Library upload always sends 2048 bytes, even when file is smaller

Found bug in Digi FTP library. FTP file sending always sent 2048 bytes, when file was shorter. It seems the problem was, that it was sending as many bytes as was allowed by the socket. rc = sock_writable(…) later on (in ftp_client_tick function) there is a call to sock_fastwrite(…) in which the length parameter is this rc, which is the maximum amount of bytes,that can be transmitted. This is the mentioned 2048, which is incorrect. It should be the length of the file: ftp.length. When changed like this it started to send the right amount of bytes to FTP server. Changed this temporarily to FTP_CLIENT.LIB file and worked fine.

I would appreciate if somebody would confirm, this is a known problem or if there is something else going on (misunderstanding etc.).

Yep it does look like there is a problem there, looking a the DC 10.72 code it behaves as you said if there is no data handler. I think you would need to check rc against the remaining data i.e. ftp.length - ftp.offset as it also means that if the file is greater than 2048 bytes, the last chunk written will be 2048 bytes even if it is actually shorter.