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

[REBOL] Re: Reading tcp ports in rebol line by line

From: holger:rebol at: 8-Nov-2000 21:41

On Thu, Nov 09, 2000 at 05:55:59PM +1300, Andrew Martin wrote:
> Paul asked: > > what was the bug in tcp ports? > > The bug in rebol was two things: > 1 A empty port in line mode doesn't produce none, it just waits for data. > 2 An empty port always has a rebol newline character in it's buffer.
It's a little different. Whether 'copy returns none or waits for data depends on whether you used the no-wait refinement for 'open. Without the refinement 'copy blocks, with it 'copy returns none if no data is available. This behavior applies to all /direct ports, not just ports in line mode. Regarding the newline character: in current versions there is the problem that in some circumstances after reading an incoming line that is terminated by crlf only the cr is read from the input buffer (a side effect of REBOL's automatic crlf conversion), not the nl, i.e. after the first line 'wait will return immediately (because of the nl), but 'copy still blocks, because no full new line is available. The current workaround is to explicitly tell REBOL what line terminator you want to use, by using the /with refinement, e.g. /wait "^/". The bug will be fixed in one of the next experimentals. -- Holger Kruse [holger--rebol--com]