Francois PIETTE wrote: >> 1) Command Open succeeds. >> 2) After the server received command User it closes the connection >> (FIN/ACK). >> 3) OnSessionClosed triggers with ErrCode 0. >> 4) OnRequestDone triggers with ErrCode 0 and the status code from >> previous request. >> >> Would you agree that is a bug? > > If the server closes the connection as a reaction to a command except > quit, then OnrequestDone should report a failure code, probably > WSAECONNRESET.
Do you see anything obviously wrong in this fix? procedure TCustomFtpCli.ControlSocketSessionClosed( Sender : TObject; ErrCode : Word); var LClosedState : TFtpState; begin LClosedState := FState; if FConnected then begin FConnected := FALSE; if FState <> ftpAbort then StateChange(ftpNotConnected); if Assigned(FOnSessionClosed) then FOnSessionClosed(Self, ErrCode); end; if FState <> ftpAbort then StateChange(ftpInternalReady); if FRequestType <> ftpRqAbort then begin if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and //<== (LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then begin //<== FLastResponse := '500 Control connection closed - ' + GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to this fix FStatusCode := 500; FRequestResult := FStatusCode; { 06 apr 2002 } SetErrorMessage; end; TriggerRequestDone(FRequestResult); end; end; -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be