In
this post, I show the best technique that I have found to get the return codes. It is imperfect, and I'd love to see a better idea. Because it's so hard to know how long to sleep, I usually take my best shot, then double it. This technique wastes a lot of clock time.
Yeah, there are several codes that can result from an operation failing. You will need to check for them all. But it's not like every programmer can make up his own codes or anything. The codes are documented in
RFC 959. Any ftp server that returns different codes is broken.
For transfers, I would just look for the presense of a code 226. That would indicate that the transfer worked. No code 226, it must've failed. But if you want to diagnose the error, this won't be enough. It depends on how far you want to go.
Also, I don't understand why your file sizes are off. This sounds like you did an ascii transfer when you needed a binary transfer.