FTP Zugriffe

Alle Fragen zur Netzwerkkommunikation
otisoft
Beiträge: 80
Registriert: Mo 3. Nov 2014, 13:13
OS, Lazarus, FPC: Winux (L 0.9.xy FPC 2.2.z)
CPU-Target: xxBit

Re: FTP Zugriffe

Beitrag von otisoft »

Ich hab Win8.1 und NORTON als Sicherheitsprogramm, der hat aber nichts gesagt wie BOKIERD oder so. :cry:
Sorry, ich habe das Forum verlassen!

otisoft
Beiträge: 80
Registriert: Mo 3. Nov 2014, 13:13
OS, Lazarus, FPC: Winux (L 0.9.xy FPC 2.2.z)
CPU-Target: xxBit

Re: FTP Zugriffe

Beitrag von otisoft »

Ich hab Win 8.1 und NORTON der sagt aber nix von BLOCKIERD oder so.... :cry:
Hat er das gepostet oder nicht? Ich hatte das schon mal geschrieben...
Sorry, ich habe das Forum verlassen!

shokwave
Beiträge: 470
Registriert: Do 15. Nov 2007, 16:58
OS, Lazarus, FPC: Win11/Ubuntu Budgie (L 3.0 FPC 3.2.2)
CPU-Target: i386, x64
Wohnort: Gera

Re: FTP Zugriffe

Beitrag von shokwave »

Und auf "connect" hast du vorher (also vor "download") auch gedrückt?
mfg Ingo

otisoft
Beiträge: 80
Registriert: Mo 3. Nov 2014, 13:13
OS, Lazarus, FPC: Winux (L 0.9.xy FPC 2.2.z)
CPU-Target: xxBit

Re: FTP Zugriffe

Beitrag von otisoft »

Ja, hab ich! :roll:
Sorry, ich habe das Forum verlassen!

Michl
Beiträge: 2505
Registriert: Di 19. Jun 2012, 12:54

Re: FTP Zugriffe

Beitrag von Michl »

Anbei ein bei mir funktionierendes Bsp (download HTTP) mit Synapse (habe Synapse sogar mit eingepackt):

Code: Alles auswählen

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  s: String;
begin
  Progressbar1.Position:=0;
  http:=THTTPSend.Create;
  http.Sock.OnStatus:=@SocketGetCallBack;
  if http.HTTPMethod('HEAD', Edit1.Text) then
  begin
    // search for "Content-Length:" in header
    for i:=0 to http.Headers.Count-1 do
    begin
      s:=UpperCase(http.Headers[i]);
      if Pos('CONTENT-LENGTH:', s) > 0 then
        TotalBytes:=StrToIntDef(Copy(s, Pos(':', s) + 1, Length(s)), 0);
    end;
 
    // get the file
    http.Headers.Clear;
    if http.HTTPMethod('GET', Edit1.Text) then
    begin
      s:=Edit1.Text;
      if not GetFileName(s) then s:='DummyFile.dat';
      http.Document.SaveToFile(s);
 
      Progressbar1.Position:=0;
      ShowMessage('File['+s+'] von ['+Edit1.Text+'] erfolgreich heruntergeladen!');
    end;
  end;
  http.Free;
end;
 
procedure TForm1.SocketGetCallBack(Sender: TObject;
  Reason: THookSocketReason; const Value: String);
begin
  if TotalBytes = 0 then
    Exit;
 
  case Reason of
    HR_ReadCount:
      begin
        Inc(CurrentBytes, StrToIntDef(Value, 0));
        ProgressBar1.Position := Round(1000 * (CurrentBytes / TotalBytes));
      end;
    HR_Connect:
      CurrentBytes := 0;
  end;
end;

Das Bsp. musst Du aber auch downloaden und entpacken.

Viel Erfolg!
Dateianhänge
HTTP Download.zip
(424.84 KiB) 90-mal heruntergeladen

Code: Alles auswählen

type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection; 

otisoft
Beiträge: 80
Registriert: Mo 3. Nov 2014, 13:13
OS, Lazarus, FPC: Winux (L 0.9.xy FPC 2.2.z)
CPU-Target: xxBit

Re: FTP Zugriffe

Beitrag von otisoft »

Danke, danke, danke
das war's was ich brauchte..
Gibt's hier bei Benutzern auch Punkte, die andere Benutzer in die höhe treiben können.. :lol:
Dann wür'd ich das tun.. Das hatte ich gesucht :mrgreen:
Sorry, ich habe das Forum verlassen!

Antworten