Add measure sending rate and calculate using that.
[brdnet.git] / TestTC.pas
blob641d2b122471aa1e750220ca01130315481f9df3
1 unit TestTC;
2 INTERFACE
3 IMPLEMENTATION
4 USES ServerLoop
5 ,TC
6 ,MemStream
8 type t=object
9 tcs:TC.tTCS;
10 cnt:byte;
11 buf: array [1..4096] of char;
12 procedure CanSend(size:word);
13 procedure Init;
14 end;
16 procedure t.CanSend(size:word);
17 var s:tMemoryStream;
18 begin
19 s.Init(@buf,0,4096);
20 tcs.WriteHeaders(s);
21 if size>s.size then size:=s.size;
22 s.Skip(size-1);
23 s.WriteByte(9);
24 tcs.Send(s);
25 end;
27 procedure t.Init;
28 begin
29 cnt:=0;
30 tcs.Init;
31 tcs.rid:=42;
32 tcs.lid:=22;
33 tcs.Remote.FromString('//ip4/192.168.1.47/3511');
34 tcs.CanSend:=@CanSend;
35 TC.RegTXer(tcs);
36 tcs.Start;
37 writeln('TestTC: Transfer started');
38 end;
40 var o:t;
41 BEGIN
42 o.Init;
43 END.