AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Indy 10 - Progressbar arbeitet nicht mehr mit OnWork
Thema durchsuchen
Ansicht
Themen-Optionen

Indy 10 - Progressbar arbeitet nicht mehr mit OnWork

Ein Thema von hsbc · begonnen am 25. Jul 2006 · letzter Beitrag vom 15. Dez 2008
 
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.778 Beiträge
 
Delphi 10.4 Sydney
 
#34

Re: Indy 10 - Progressbar arbeitet nicht mehr mit OnWork

  Alt 2. Aug 2006, 17:49
Was passiert denn wenn Du in der Write Methode bei onWork die Kommentierung wieder entfernst?

Geht es dann?

Delphi-Quellcode:
procedure TIdIOHandler.Write(AStream: TIdStream; ASize: Int64 = 0;
  AWriteByteCount: Boolean = FALSE);
var
  LBuffer: TIdBytes;
  LBufSize: Integer;
  // LBufferingStarted: Boolean;
begin
  if ASize < 0 then begin //"-1" All form current position
    LBufSize := AStream.Position;
    ASize := AStream.Size;
    //todo1 is this step required?
    AStream.Position := LBufSize;
    ASize := ASize - LBufSize;
  end
  else if ASize = 0 then begin //"0" ALL
    ASize := AStream.Size;
    AStream.Position := 0;
  end;

  //else ">0" ACount bytes
  EIdIOHandlerRequiresLargeStream.IfTrue((ASize > High(Integer)) and (not LargeStream));

  // RLebeau 3/19/2006: DO NOT ENABLE WRITE BUFFERING IN THIS METHOD!
  //
  // When sending large streams, especially with LargeStream enabled,
  // this can easily cause "Out of Memory" errors. It is the caller's
  // responsibility to enable/disable write buffering as needed before
  // calling one of the Write() methods.
  //
  // Also, forcing write buffering in this method is having major
  // impacts on TIdFTP, TIdFTPServer, and TIdHTTPServer.

  {
  LBufferingStarted := not WriteBufferingActive;
  LBufferingStarted := False;

  if LBufferingStarted then begin
    WriteBufferOpen;
  end;
  }


  //try
    if AWriteByteCount then begin
      if LargeStream then begin
         Write(ASize);
      end else begin
         Write(Integer(ASize));
      end;
    end;

    BeginWork(wmWrite, ASize);
    try
      while ASize > 0 do begin
        SetLength(LBuffer, FSendBufferSize); //BGO: bad for speed
        LBufSize := Min(ASize, FSendBufferSize);
        // Do not use ReadBuffer. Some source streams are real time and will not
        // return as much data as we request. Kind of like recv()
        // NOTE: We use .Size - size must be supported even if real time
        LBufSize := TIdStreamHelper.ReadBytes(AStream, LBuffer, LBufSize);
        if LBufSize = 0 then begin
          raise EIdNoDataToRead.Create(RSIdNoDataToRead);
        end;
        SetLength(LBuffer, LBufSize);
        Write(LBuffer);
        // RLebeau: DoWork() is called in TIdIOHandlerStack.WriteDirect() <---------------

        DoWork(wmWrite, LBufSize); <--- vielleicht wenn es nicht laufen sollte, hier doWork wieder aktivieren.

        Dec(ASize, LBufSize);
      end;
    finally
      EndWork(wmWrite);
      LBuffer := nil;
    end;
  {
    if LBufferingStarted then begin
      WriteBufferClose;
    end;
  except
    if LBufferingStarted then begin
      WriteBufferCancel;
    end;
    raise;
  end;
  }

end;
Klaus
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz