Chcę napisać serwer FTp pod Delphi.Korzystałem z komponentu TFTP ale nie zabardzo wówczas chodziło.Czy można to zrobić jakoś inczej?
Proszę o wskazówki [cya]
Masz szczescie, bo wlasnie sie tym zajmuje :-) !
Tu masz kod:
[code]unit MainFrmU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdIPWatch, FtpSrv, Buttons,
ExtCtrls;
type
TMainFrm = class(TForm)
FTP: TFtpServer;
IPW: TIdIPWatch;
Timer: TTimer;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure TimerTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainFrm: TMainFrm;
implementation
{$R *.dfm}
procedure TMainFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
FTP.DisconnectAll;
FTP.Active:=False;
end;
procedure TMainFrm.FormCreate(Sender: TObject);
begin
FTP.Addr:=IPW.LocalIP;
FTP.MaxClients:=3;
FTP.Active:=True;
FTP.Start;
end;
procedure TMainFrm.TimerTimer(Sender: TObject);
begin
ShowWindow(MainFrm.Handle,SW_HIDE);
MainFrm.Visible:=False;
Timer.Enabled:=False;
end;
end.
[/code]
To jest z wykorzystaniem ICS <url>www.overbyte.be</url> i Indy (TIdIPWatch) jest to serwer bez zabezpieczen - prosty jak Lepper. Jakby co to mail me.
P.S.: Timer mozesz wypieprzyc, bo to do czego innego (ukrywa forme itp, a chyba nie piszesz trojana ;-)).
Pozdrawiam!