I have been maintaining a product that is using adFTPCustomClient (and more of ADPro). Over the years I have made some small fixes locally. Some of them I can see have been implemented in the official code, but some are not. It has been some time since I made these changes and I am not 100% confident that they are correct, so I post this a suggestion to look at.
point 1)
In TApdCustomFtpClient.DataConnect the code goes:
<..>
if PassiveMode then begin
DataSocket := Sock.CreateSocket;
Result := (DataSocket <> Invalid_Socket);
Sock.SetAsyncStyles(DataSocket, FD_CLOSE or FD_READ or FD_WRITE);
SendCommand(PopCommand);
FIX: Remove SendCommand(PopCommand) so it becomes just "PopCommand" to avoid duplicate sent
Point 2)
In TApdCustomFtpClient.PostStatus the code goes:
<..>
begin
PData := nil;
if (Code > scLogin) and (Code <> scProgress) then
ChangeState(psIdle);
FIX: I have noted that the last line (ChangeState(psIdle), should also be guarded by this if statement:
if not (ProcessState in [psGet, psPut, psDir]) then //29.may.2008, used to always change state. Replycode should handle that (or timeout)
Point 3)
I believe there is bug that can let TApdCustomFtpClient.PutDate can be called before FTP response code 150 has been received. I have a pretty ugly hack to avoid that so I will not give any suggested solution
Regards,
Torsten Gabrielsen
I have been maintaining a product that is using adFTPCustomClient (and more of ADPro). Over the years I have made some small fixes locally. Some of them I can see have been implemented in the official code, but some are not. It has been some time since I made these changes and I am not 100% confident that they are correct, so I post this a suggestion to look at.
point 1)
In TApdCustomFtpClient.DataConnect the code goes:
<..>
if PassiveMode then begin
DataSocket := Sock.CreateSocket;
Result := (DataSocket <> Invalid_Socket);
Sock.SetAsyncStyles(DataSocket, FD_CLOSE or FD_READ or FD_WRITE);
SendCommand(PopCommand);
FIX: Remove SendCommand(PopCommand) so it becomes just "PopCommand" to avoid duplicate sent
Point 2)
In TApdCustomFtpClient.PostStatus the code goes:
<..>
begin
PData := nil;
if (Code > scLogin) and (Code <> scProgress) then
ChangeState(psIdle);
FIX: I have noted that the last line (ChangeState(psIdle), should also be guarded by this if statement:
if not (ProcessState in [psGet, psPut, psDir]) then //29.may.2008, used to always change state. Replycode should handle that (or timeout)
Point 3)
I believe there is bug that can let TApdCustomFtpClient.PutDate can be called before FTP response code 150 has been received. I have a pretty ugly hack to avoid that so I will not give any suggested solution
Regards,
Torsten Gabrielsen