Thema: Delphi FTP-Server (indy)

Einzelnen Beitrag anzeigen

Kreilon

Registriert seit: 15. Sep 2004
16 Beiträge
 
#3

Re: FTP-Server (indy)

  Alt 15. Sep 2004, 23:01
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdMappedPortTCP,
  StdCtrls, IdFTPServer, IdTCPConnection, IdTCPClient, IdFTP,
  IdUserAccounts;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    IdFTPServer1: TIdFTPServer;
    Button2: TButton;
    IdFTP1: TIdFTP;
    Button3: TButton;
    Label1: TLabel;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure IdFTPServer1Execute(AThread: TIdPeerThread);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
  begin
    idFTPServer1.DefaultPort:=21;
    idFTPServer1.AllowAnonymousLogin:=true;
    idFTPServer1.Active:=true;
  end;

procedure TForm1.Button3Click(Sender: TObject);
  begin
    idftpserver1.Active:=false;
  end;

procedure TForm1.Button2Click(Sender: TObject);
  begin
    idftp1.Host:='192.168.0.3';
    idftp1.Port:=21;
    idftp1.Connect;
    //idftp1.Username:='weiss';
    //idftp1.Password:='weiss';
    //idftp1.Login;
    Edit1.Text:=idftp1.ReadLn;
  end;

procedure TForm1.IdFTPServer1Execute(AThread: TIdPeerThread);
  begin
    with Athread.Connection do
      begin
        Writeln('Connected');
      end;
  end;

end.
Ok. Hier der lesbare.
  Mit Zitat antworten Zitat