[REBOL] Re: [BUG?] read-io & write-io or Wait or is TCL better?
From: Rebolinth:nodep:dds:nl at: 24-Dec-2003 22:30
Hello Andrew,
The packet mismatch comes from a previous packet-size inside the buffer
and is added to the next buffer (so the buffer is not cleared correctly!!)
i.e.
bufsize: 8192 * 10
buffer: make binary! bufsize
-- packet #99
B: 1024 ;; length? buffer
R: 1024 ;; size: read-io
T: 1024 ;; write-io
-- packet #100
B: 5120 ;; length? buffer
R: 4096 ;; size: read-io
T: 4096 ;; write-io
<<crash>>
This is a part my code for the IO,
and is works fine with > 30 MB of Binary/ascii FTP data...
This function runs every xx millisecond so i can emagine the
make binary! bufsize
is not quick enough????
sio: func [ IN OUT [port!] name [string!] ][
bufsize: 8192 * 10
buffer: make binary! bufsize
while [ positive? size: read-io IN buffer bufsize ][
prin name
prin [ " B:[ " length? buffer " ]" ]
prin [ " R:[ " size " ] " ]
write-io OUT buffer size
print [ " T:[ " size " ] " ]
print [ to-binary buffer ]
]
]
Here is my (very older) TCL code ;-)
http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/164989/index_txt
(R)egards,
Norman.