> I'll start by saying that I am using the daily snapshot of 12/18/2011,
> Delphi 7.1, Win XP SP3 all patches as of 12/18/2011.
> using
> TFtpCli I get a 500 error on a Quit even though the server returns a
> 221 response to the quit.   I've tracked it down to
> TCustomFtpCli.ControlSocketSessionClosed
> I changed:
> if FRequestType  ftpRqAbort then begin
> To:
> if
> (FRequestType  ftpRqAbort) and (FRequestType  ftpQuitAsync) then begin
> and the problem is resolved.
> Please note that the
> machine the program runs on is a 3.4g P4 with Gigabit networking to a
> DS3 backbone.  And this is a timing related problem.  I can not
> reproduce the error on my development machine.

Seems the same problem I noticed on OSX recently, please try the 
following fix as in the IPv6 branch for Windows as well, does it work
for you?  

procedure TCustomFtpCli.ControlSocketSessionClosed(
    Sender  : TObject;
    ErrCode : Word);
    LClosedState : TFtpState;
    LClosedState := FState;
    if ((FRequestType = ftpQuitAsync) or (FFctPrv = ftpFctQuit)) and
       (FState = ftpInternalReady) and (ErrCode <> 0) then
        ErrCode := 0;
    { Sometimes ErrCode ECONNRESET for unknown reason when TFtpServer and client
      are running on the same host. Seen on MacOS, however when QUIT response
      has been received we may safely ignore all possible errors. }
    if FConnected then begin
        FConnected := FALSE;
        if FState <> ftpAbort then
        if Assigned(FOnSessionClosed) then
            FOnSessionClosed(Self, ErrCode);
    if FState <> ftpAbort then
    if FRequestType <> ftpRqAbort then begin
        if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and
           (LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then begin
            FLastResponse  := '500 Control connection closed - ' +
            FStatusCode    := 500;
            FRequestResult := FStatusCode;    { 06 apr 2002 }

Arno Garrels
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to