It is possible that the 226 can come in before the client has received all the data. When I connect to my Mac over wireless, I can consistently reproduce this behavior. When I tried closing the datasocket on a 226, I got partial files.
Ok, to be honest, the 226 does not mean in every case, everything went ok, as per the ftp rfc it just mean: Closing data connection.If you sent an ABORT command, the successful exexution would also be acknowledged by the server with 226.Furthermore you also need to know other status codes that occurs before the 226, so it's not enough to just wait for 226.
And of course you need to check, if you received the amount of data bytes you expected.
I believe the true signal that the transfer has completed comes in the form of an error 150 on the datasocket, which I believe is currently being handled silently / ignored by Basic4PPC (I'm really not sure).
I'm not sure, what you mean with a datasocket.As i understand, you talk to the network lib, which is a tcp stack, and i'm not aware of errors like 150 in there.In terms of ftp protocol , 150 means:
150 File status okay; about to open data connection.
This happens right after the RETR command and just before the data transfer of the requested file is starting.
Basic4PPC or the underlying network lib are not aware of the ftp protocol, so
they cannot return ftp status codes.They just return data packets you receive from the server and it is up to you to read and process these.TCP as an underlying layer is also not aware of ftp.It just carries data between a source port and a destination port and ensures, that the data requested is sent & received ( or returning timeout / error).
I recommend to read and follow the RFC:
RFC 959 - File Transfer Protocol
regards,
Frank