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

[REBOL] Re: Reading from stdi - what am I doing wrong?!

From: agem:crosswinds at: 14-Jul-2001 0:17

RE: [REBOL] Re: Reading from stdi - what am I doing wrong?! [chris--starforge--co--uk] wrote:
> On 13-Jul-01, Paul Tretter wrote: > > > I would like to see more of the script. Anytime I ever use ports - I stay > > away from read-io and write-io. > > Sending the whole script would compromise my site security, but these two > demonstrate the important parts: > > ------------ > > #!/path/to/rebol > > REBOL [] > > buffer: make string! 50000 > read-io system/ports/input buffer 50000 > > write %robot.out buffer > > ------------- > or > ---------- > > #!/path/to/rebol > > REBOL [] > > write %robot.out copy system/ports/input > > ------------- > > The top version works fine, until I send a large email in which case only > part of it is obtained. The second version works for any size email except that > I end up with
vague remembering read-io does not wait it returns 0 if there is no more data, lenght otherwise something like buffer: make string! 100000 until[ wait port 0 = read-io port tail buffer 100000] could work.
> {To: [address--starforge--co--uk]}{from: [chris--starforge--co--uk]}{Date: .....}{body > of the email} > > in buffer. I haven't tested the scripts with large mails locally, but I > guess the problem with the read-io version is that it's not waiting for all > the email to come in. The copy would work fine, if it gave me the email as > one big strings with newlines intact... > > Chris
-Volker