AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi FTP Download Geschwindigkeit anzeigen
Thema durchsuchen
Ansicht
Themen-Optionen

FTP Download Geschwindigkeit anzeigen

Ein Thema von Blumi · begonnen am 1. Okt 2005 · letzter Beitrag vom 1. Okt 2005
Antwort Antwort
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#1

Re: FTP Download Geschwindigkeit anzeigen

  Alt 1. Okt 2005, 08:36
Hi,

schau dir die Zeilen mit //// an:

Delphi-Quellcode:
var
  dwStarted, dwElapsed: cardinal;
  dSpeed: double;

...
  dwBytesRead := 0;
  bufsize := READ_BUFFERSIZE;

  //// get a time reference
  dwStarted := GetTickCount;

  while (bufsize > 0) do
  begin
    Application.ProcessMessages;

    if not InternetReadFile(
      hFile,
      @buffer, // address of a buffer that receives the data
      READ_BUFFERSIZE, // number of bytes to read from the file
      bufsize
    ) then Break; // receives the actual number of bytes read

    if (bufsize > 0) and (bufsize <= READ_BUFFERSIZE) then
      BlockWrite(LocalFile, buffer, bufsize);
    dwBytesRead := dwBytesRead + bufsize;

    //// calculate time elapsed in ms
    dwElapsed := GetTickCount - dwStarted;
    //// dSpeed measured in KB/s
    dSpeed := dwBytesRead / (dwElasped * 1.024);

    { Show Progress }
    ProgressBar.Position := Round(dwBytesRead * 100 / fileSize);
    Form1.Label1.Caption := Format('%s of %s / %d %%', [
      FmtFileSize(dwBytesRead),FmtFileSize(fileSize) ,ProgressBar.Position
    ]);
  end;
...
Grüße vom marabu
  Mit Zitat antworten Zitat
Antwort Antwort


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 07:36 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-2025 by Thomas Breitkreuz