thank you very much for your reply, Remy.
i'm really stuck with the 'put' event handler.
here is some code to try and work out what's going on... all i get is a
timeout (although a 'get' works fine).
i've changed the threadedevent property to true, and as you can see both the
client and server is on the same machine, communicating via the loopback
address:
i haven't been able to find anything much about this component on the indy
website faq.
this appears to be the best solution to my config settings problem - i won't
need to sent files any bigger than 4096 bytes, but the files I am sending in
this example are less than 100 bytes.
please help!
type
TForm1 = class(TForm)
IdTrivialFTPServer1: TIdTrivialFTPServer;
IdTrivialFTP1: TIdTrivialFTP;
Button1: TButton;
Button2: TButton;
procedure IdTrivialFTPServer1ReadFile(Sender: TObject; var FileName:
string; const PeerInfo: TPeerInfo;
var GrantAccess: Boolean; var AStream: TStream; var
FreeStreamOnComplete: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure IdTrivialFTPServer1WriteFile(Sender: TObject; var FileName:
string; const PeerInfo: TPeerInfo;
var GrantAccess: Boolean; var AStream: TStream; var
FreeStreamOnComplete: Boolean);
procedure Button2Click(Sender: TObject);
procedure IdTrivialFTPServer1TransferComplete(Sender: TObject; const
Success: Boolean; const PeerInfo: TPeerInfo;
var AStream: TStream; const WriteOperation: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
teststream : tmemorystream;
procedure TForm1.Button1Click(Sender: TObject);
begin
idtrivialftp1.Get('whatever.txt', 'c:\output.txt');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
idtrivialftp1.Put('c:\output.txt', 'upload.txt');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
teststream := tmemorystream.Create;
teststream.LoadFromFile('c:\test.txt');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// teststream.Free;
end;
procedure TForm1.IdTrivialFTPServer1ReadFile(Sender: TObject; var FileName:
string; const PeerInfo: TPeerInfo;
var GrantAccess: Boolean; var AStream: TStream; var FreeStreamOnComplete:
Boolean);
begin
grantaccess := true;
freestreamoncomplete := false;
astream := teststream;
astream.Position := 0;
end;
procedure TForm1.IdTrivialFTPServer1TransferComplete(Sender: TObject; const
Success: Boolean; const PeerInfo: TPeerInfo;
var AStream: TStream; const WriteOperation: Boolean);
begin
if assigned(astream) then astream.Free;
end;
procedure TForm1.IdTrivialFTPServer1WriteFile(Sender: TObject; var FileName:
string; const PeerInfo: TPeerInfo;
var GrantAccess: Boolean; var AStream: TStream; var FreeStreamOnComplete:
Boolean);
var
outps: tmemorystream;
begin
showmessage(filename);
grantaccess := true;
freestreamoncomplete := true;
outps := tmemorystream.Create;
astream := outps;
{freestreamoncomplete := false;
//
astream.Position := 0;
outps := tmemorystream.create;
outps.CopyFrom(astream, astream.size);
outps.Position := 0;
outps.SaveToFile('c:\'+filename);
outps.Free; }
end;
"Remy Lebeau (TeamB)" <
XXXX@XXXXX.COM>writes
Quote
"Mark" <XXXX@XXXXX.COM>writes
news:44835101$XXXX@XXXXX.COM...
>the website www.indyproject.org/ is currently down
That is because it was recently moving to a new server. It is back online
now.
>i keep getting range check errors with the write event
Please show your actual code. Which version of Indy are you using? How
large are the files you are trying to send?
>if there is a bug in this component (i'm using the build issued
>with delphi 2006)
Indy 9 or 10, though? BDS 2006 ships with both. Either way, the
development snapshots for both on www.indyproject.org are a little
bit newer than the ones that ship with BDS.
Gambit