Hello everybody
finaly (nearly finaly) i have "solved" my problems with a workaround.

for the large file support i changed all the stuff to int64. and it works 
:-)

for sending noops while uploading (to keep the control connection alive) i 
done some bad things ;-)

1.st i added in my progress procedure this code.
-------------------------------------------------------------
procedure TForm1.FTPicsProgress(Sender: TObject; Count: int64;  var Abort: 
Boolean);
begin
   { Be sure to update screen only once every second }
   if FLastProgress < GetTickCount then begin
      FLastProgress := GetTickCount + 1000;

      inc(FLastProgressCNT);
      if FLastProgressCNT >29 then begin
         FLastProgressCNT:=0;
         FTPics.NOOP;
      end;
-------------------------------------------------------------



2. i extend FTPcli with this NOOP function.
i do send POOP (or whatever) insted op noop to receive a 500 command not 
understoond witch i can filter in the point 3.
-------------------------------------------------------------
function TFtpClient.NOOP : Boolean;
begin
    TriggerDisplay('> DO FAKE NOOP BY SENDING POOP==> result 500 command 
not understoond');
    noopactive:=True;
    if FControlSocket.State = wsConnected then
        Result := FControlSocket.SendStr('POOP'+#13+#10)=6;
end;
-------------------------------------------------------------


3. to filter the "500 command not understoond" in the receive part i do 
this. (look at the end of the snip)
-------------------------------------------------------------
procedure TCustomFtpCli.ControlSocketDataAvailable(Sender: TObject; 
ErrCode: Word);
var
    Len  : Integer;
    I, J : Integer;
    p    : PChar;
    Feat : String;
begin
    Len := FControlSocket.Receive(@FReceiveBuffer[FReceiveLen],
                                  SizeOf(FReceiveBuffer) - FReceiveLen - 1) 
;

    if FRequestType = ftpRqAbort then
        Exit;

    if Len = 0 then begin
        { Remote has closed. We will soon receive FD_CLOSE 
(OnSessionClosed) }
        { FControlSocket.Close;                                             
 }
        Exit;
    end;
    if Len < 0 then
        Exit;

    FReceiveBuffer[FReceiveLen + Len] := #0;
    FReceiveLen := FReceiveLen + Len;

    while FReceiveLen > 0 do begin
        if ftpAcceptLF in FOptions then begin
            I := Pos(#10, FReceiveBuffer);
            J := I;
        end
        else begin
            I := Pos(#13#10, FReceiveBuffer);
            J := I + 1;
        end;
        if I <= 0 then
            break;
        if I > FReceiveLen then
            break;

        FLastResponse := Copy(FReceiveBuffer, 1, I - 1);
        { Remove trailing control chars }
        while (Length(FLastResponse) > 0) and
              (FLastResponse[Length(FLastResponse)] in [#10, #13]) do
             SetLength(FLastResponse, Length(FLastResponse) - 1);

        { V2.90 some FTP responses are multiline, welcome banner, FEAT  }
        { command, keep them all but do not exceed 64KB to avoid DOS    }
        if LongInt(Length(FLastMultiResponse)) < 65536 then
            FLastMultiResponse := FLastMultiResponse + FLastResponse + 
#13#10;

        if Assigned(FOnResponse) then
            FOnresponse(Self);

{$IFDEF DUMP}
        FDumpBuf := '>|';
        FDumpStream.WriteBuffer(FDumpBuf[1], Length(FDumpBuf));
        FDumpStream.WriteBuffer(FLastResponse[1], Length(FLastResponse));
        FDumpBuf := '|' + #13#10;
        FDumpStream.WriteBuffer(FDumpBuf[1], Length(FDumpBuf));
{$ENDIF}
{$IFDEF VER80}
        { Add a nul byte at the end of string for Delphi 1 }
        FLastResponse[Length(FLastResponse) + 1] := #0;
{$ENDIF}
        FReceiveLen := FReceiveLen - J;
        if FReceiveLen > 0 then
            Move(FReceiveBuffer[J], FReceiveBuffer[0], FReceiveLen + 1)
        else if FReceiveLen < 0 then
            FReceiveLen := 0;

// ============================================== this is the NOOP 
workaround if noopactive and (pos('500',FLastResponse)>0) then begin
           noopactive:=False;
           exit; // delete fake noop (POOP 500 cammand not undastnd while 
uploading) from receive buffer and do nothing
        end;


-------------------------------------------------------------




it looks like this workaround solves my problems and so i can go to 
hollydays next week :-)
when i am back i will try to make a "clean" solution for the noop problem.

thank your for any comments and suggestions.
   roland
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to