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

[REBOL] Re: pop problems

From: gscottjones:mchsi at: 16-Oct-2002 15:57

Hi, Graham, From: "Graham Chiu" message: http://www.escribe.com/internet/rebol/m26582.html ...
> I tracked the problem down to > > read-til-dot: func [port buf][ > while [(line: system/words/pick port/sub-port 1) <> > "."] [ > if none? line [ print "Got none .. aborting" break > ] > insert tail buf line > insert tail buf newline > ] > buf > ] > > where /pick port 1 returns none ... and keeps returning > none in an endless loop. > > I put the above trap in the function, but then get a tcp > error, as can be seen when I then do > > pick mailbox 2 > > Does anyone knowledgeable in matters Rebol tcp have a work > round for me?
Getting none on the port suggests an error that is not necessarily originating from REBOL. (Maybe you weren't implying it is a REBOL problem. :-) The POP protocol says that for multiline messages, that the message is sent and then a single line with a period is sent. A none return suggests a pop server error or dropped packets/congestion. At any rate, if you are checking for this state in order to debug the whole situation, then I think your way will work, but the function needs to return a value in order to avoid an error. Try something like: func [port buf][ while [(line: system/words/pick port/sub-port 1) <> "."] [ if none? line [ print "Got none .. aborting" break/return buf ] insert tail buf line insert tail buf newline ] buf ] where the break returns the buffer named buf. This should avoid an error. If it is some sort of network congestion problem, then I will guess that you may likely see other shortened messages due to a premature abortion on the port read (meaning there was momentarily nothing to be read). Experimentation will readily reveal if this is a problem. Good luck, and hope my mini-fix avoids the error. --Scott Jones