repo.or.cz
/
brdnet.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Convert TC to periodic ack. Change packet struct. No size probing and timeouts.
[brdnet.git]
/
TestTC.pas
blob
7a12f8766190fe6ad0507d75ec11851855c43591
1
unit
TestTC
;
2
INTERFACE
3
IMPLEMENTATION
4
USES
ServerLoop
5
,
TC
6
,
MemStream
7
;
8
type
t
=
object
9
tcs
:
TC
.
tTCS
;
10
cnt
:
byte
;
11
buf
:
array
[
1
.
.4096
]
of
char
;
12
procedure
CanSend
;
13
procedure
Init
;
14
end
;
15
16
procedure
t
.
CanSend
;
17
var
s
:
tMemoryStream
;
18
var
size
:
word
;
19
begin
20
s
.
Init
(@
buf
,
0
,
4096
);
21
size
:=
tcs
.
MaxSize
(
4096
);
22
tcs
.
WriteHeaders
(
s
);
23
if
size
>
s
.
size
then
size
:=
s
.
size
;
24
s
.
Skip
(
size
-
1
);
25
s
.
WriteByte
(
9
);
26
tcs
.
Send
(
s
);
27
end
;
28
29
procedure
t
.
Init
;
30
begin
31
cnt
:=
0
;
32
tcs
.
Init
;
33
tcs
.
Remote
.
FromString
(
'//ip4/192.168.1.49/3519'
);
34
tcs
.
CanSend
:=@
CanSend
;
35
TC
.
RegTXer
(
tcs
);
36
tcs
.
Start
;
37
writeln
(
'TestTC: Transfer started'
);
38
end
;
39
40
var
o
:
t
;
41
BEGIN
42
o
.
Init
;
43
END
.