Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [BUG?] read-io & write-io or Wait or is TCL better?

From: petr:krenzelok:trz:cz at: 7-Aug-2003 9:23

Rebolinth wrote:
>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 ] > ] >] >
If I remember correctly, I got such odd behavior if I did not CLEAR buffer each time - so, try to put "clear buffer" right after you write-io your data, it may help. We just should decide, if it is a bug or not, as other non-binary data do work (according to what you say), but I remember someone (Holger?) explained it in a reasonable way in the past ... but I can be wrong ... Cheers, -pekr-