Wim,
> Please, could some-one help me in parsing a little example for a
> progress-bar with ftp-upload ? Of course, a Delphi-source, not a
> BCB-source.
I sent here an example on Tuesday 23 January 2007.
However it probably was some server problem that day and I sent to your
e-mail. Did you shold chek you e-mail box. This is the copy:
On Tuesday 23 January 2007 07:12, Wim Vanmaele wrote:
> I can send a file, but when it is a file of about 12 Mb it would be verry
> interesting following the progress of the transfert.
> I already looked for the examples, but I do no understand them, or worser,
> I do not know exactly how, where en when. I saw I had to make an
> connection to
> tftpsend1.Dsock.onstatus, but that is all I can follow.
> Can someone help me please ?
It seems there is some problem to send reply on Synapse maillist.
Anyway, this may help you to solve the problem:
There is two event hooks now: OnStatus and OnMonitor.
If you have to count or add sent/received data, or even get the data block, it
is very useful OnMonitor.
Anyway, this is the sample code for HTTP transfer I use. Each hooks you
may modify by your own needs. You can use both hookds or one of it, depending
of what you need to accomplish.
var
SizeIn,SizeOut: integer;
type
THookSocketStatus = procedure(Sender: TObject; Reason: THookSocketReason;
const Value: string) of object;
TMemory=pointer;
callback = class
class procedure Status (Sender: TObject; Reason: THookSocketReason;
const Value: String);
class procedure Monitor (Sender: TObject; Writing: Boolean; const
Buffer: TMemory; Len: Integer);
end;
class procedure callback.Status(Sender: TObject; Reason: THookSocketReason;
const Value: String);
var v: String;
begin
v := getEnumName (typeinfo(THookSocketReason), integer(Reason)) + ' ' +
Value;
Form1.Memo2.Lines.Add(v);
if (reason=hr_readcount) then
inc(SizeIN,StrToInt64Def(Value,0));
if (reason=hr_writecount) then
inc(SizeOUT,StrToInt64Def(Value,0));
Form1.lblIN.Caption :=inttostr(SizeIN);
Form1.lblOUT.Caption:=inttostr(SizeOUT);
application.ProcessMessages;
end;
class procedure callback.Monitor (Sender: TObject; Writing: Boolean; const
Buffer: TMemory; Len: Integer);
begin
if not writing then
inc(SizeIN, Len)
else
inc(SizeOUT, Len);
Form1.lblIN.Caption :=inttostr(SizeIN);
Form1.lblOUT.Caption:=inttostr(SizeOUT);
application.ProcessMessages;
end;
procedure TForm1.btnGETClick(Sender: TObject);
var
HTTP: THTTPSend;
F: TFileStream;
Start,Size: integer;
begin
SizeIN:=0;
SizeOUT:=0;
Memo2.Lines.Add(CRLF+'GET');
Memo2.Lines.Add('------------');
Size:=HttpGetFileSize(Edit1.text);
HTTP := THTTPSend.Create;
HTTP.Sock.OnStatus := callback.Status;
//or
HTTP.Sock.OnMonitor := callback.Monitor;
...
Sasa
--
www.szutils.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public