Home/Support/Support Forum/Dynamic C, FTP Library upload always sends 2048 bytes, even when file is smaller
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

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

0 votes
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.).
asked May 3, 2015 in Rabbit by jyrkifinland New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
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.

Regards,
Peter
answered May 4, 2015 by petermcs Veteran of the Digi Community (1,128 points)
...