r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

Graham
10-Jan-2010
[960x2]
switch/default event/type [
												read [print ["^\read:" length? port/data] 
													read port
												]
												wrote [read port]
												lookup [print query port open port]
												connect [read port]
												close [ print to-string port/data]
											][true]
so keep reading until the port is closed ...
Andreas
10-Jan-2010
[962x2]
exactly
well, gotta run now. good luck!
Graham
10-Jan-2010
[964x2]
ok,
they must be sending me two lots of data
Andreas
10-Jan-2010
[966x4]
40k+ for the LIST in pool/x
a good test :)
and it's good to know that data is appended
saves me the separate buffer in my pop3 prot
Graham
10-Jan-2010
[970]
and the buffer keeps expanding too
Graham
11-Jan-2010
[971]
Using a timeout value, largish, I can read a 5000 file listing in 
a ftp directory.  Posted latest code.
Henrik
11-Jan-2010
[972]
It sounds to me that the timeout is counting down while you are receiving 
data. That's not logical?
Graham
11-Jan-2010
[973x5]
Henrik ..I have little idea of what I'm doing .. just stumbling around 
here.
Downloaded a 16Mb file using my ftp scheme ... streamed it to disk 
directly rather than saving in any buffer.
Changed the format of the data block a little ...

write cmd [ RETR "REMR.zip" %remr.zip]
read cmd
I'm not using a dialect but if the last member of the block is a 
file, it streams the data to the file, if it's a binary eg. a buffer, 
it appends to the buffer, and if it's a  function, then uses a the 
function as a callback on the data ...
does that sound sensible?
Steeve
11-Jan-2010
[978]
not bad :-)
Graham
11-Jan-2010
[979]
using a function means you can pass your own directory parser to 
the incoming data to format it as you like.
Robert
11-Jan-2010
[980]
Graham, regarding all the overlapped words. I am/was confused too. 
I created a sequence diagram and posted it via my homepage/blog. 
Maybe it helps, and if, please provide information about errors in 
it.
Graham
11-Jan-2010
[981]
and the link is ?
Pekr
11-Jan-2010
[982]
http://www.robertmuench.de/blog/files/r3_ports.php
Henrik
11-Jan-2010
[983]
Let Carl see that diagram or put it in the wiki.
Graham
11-Jan-2010
[984x3]
Why choose the napkin style? heh
Robert, where's the source to the http://www.websequencediagrams.com/
 you used?
Brian, how can we over ride the existing schemes?
Robert
11-Jan-2010
[987x3]
I like the napkin style most.
I sent you the source via email as AltMe doesn't handle OSX line 
breaks.
BTW: I'm going to redo the diagram using yworks yEd editor. It's 
a fantastic graph layout editor and now supports swimlane diagrams.
Graham
11-Jan-2010
[990x9]
Thanks Robert .. I got it
http://rebol.wik.is/Rebol3/Schemes/Ftp

Updated so that you can supply a callback to commands

eg: 

[ LIST (:print) ]

or 

[RETR "hugefile" %downloads/hugefile.mov ]
or supply a file to stream a download.
there's a bug in that I don't return to console so I must be stuck 
in the awake handler somewhere.
and it's much slower than R2 so I must be abusing the waits ...
Brian, can you look at this to see what I'm doing wrong regarding 
the waits ...
I uploaded it as an attachment to that page ... too much hard work 
posting to the wiki ...
I guess timeout should be supplied when I use port-spec-net ...
Robert's diagram ... http://www.websequencediagrams.com/?lz=Q2xpZW50IFNjcmlwdC0-AAINOiBNYWtlIFBPUlQKAAoeU2V0IEFXQUtFIEZ1bmN0aW9uACEQUG9ydDogT1BFTgpQb3J0LT5BY3RvcgALBwAHBS0-VENQX0RldmljZSAAgREGOiBMT09LVVAKAAkRLT5Bd2FrZQAZCC1FVkVOVApub3RlIHJpZ2h0IG9mIAAbB0NhbiBkbyBJUCBmaWx0ZXJpbmcgZXRjLgoAPQUAYRUybmQAgSUGAGYSAIEZDVNlcnZlcjogQ09OTkVDVACBGwwAFQYAgSAHACAJQUNDRVBUAIEnBwAPDABCFVJFQUQKYWN0aXZhdGUgAGcRAFwTAIIvFQBCBQCCKBoAgTYHAIInHDFzdCBXUklURSBzdGFydCBmbG93IG9mIGV2ZW50cwCCLhsAMAkAgTIVAIR2BgCCPSgAQgYAgkIhUkVBRACECAdkZQCCFyYAhEQPV1JPVEUAJh0AgTIHAIRaFUFmdGVyIGEAgikHd2Ugbm93IGNhbgCDSAYAhFoaAINUGQCCHwcAhA0hAIIIGACGQxUAgjwRAIZIDwCCOwsAhkITCgCFFgUgZGF0YSAmIHJldHVybiBUUlVFIHRvIGV4aXQgV0FJVAogb3IgaXNzdWUgbmV4AIQBCGVuZCBub3RlAII9HgCGfh4AhE0G&s=modern-blue
Andreas
11-Jan-2010
[999]
looks nice
Graham
11-Jan-2010
[1000]
better than a napkin style!
Andreas
11-Jan-2010
[1001]
:)
Graham
11-Jan-2010
[1002x4]
It looks like I should be able to re-use the directory parser from 
the r2 ftp scheme ...
Just add these two lines to the definition

		scopy: :system/contexts/system/copy
		sremove: :system/contexts/system/remove
Got this on a file download ..

==TCP-event on dataport: read
?read: 15008
** Access error: cannot open: %wubi.exe reason: -3

** Where: write switch switch applier wake-up loop applier wait while 
either eit
her either read catch either either applier do
** Near: write/append port/spec/method port/data clear port/data
Might be a permissions issue ...
Andreas
11-Jan-2010
[1006x4]
sooo ....
prepared for the madness?
http://www.websequencediagrams.com/cgi-bin/cdraw?lz=U2NyaXB0LT4AAgY6IE1BS0UgUG9ydAphY3RpdmF0ZSAAHQYKbm90ZSBvdmVyAAoHLFBvcnQ6IG9wZW4gUE9QMyBwb3J0CgBICAAXBk9QRU4KZGUAOxBQb3J0LQAeBiBBY3RvcgAjBwBqCSIAEQoiACkFACEGLT5TdWJwAFAKAIEJCwAtBSIsACwNICAgIGxvb2t1cAAGBWNvbm5lY3QAEgVyZWFkIHdlbGNvbWUKZW5kIG5vdGUAXQ0AgVgGUkVBRACBNQwAgQgRAIE4DwArBQCBHCtXQUlUAEcZCgCBZwctAIFvCSBBd2FrZTogTE9PS1VQIEV2ZW4Agx4LIgAZDSIANwgALwYAgiwQAIFJDAApDwBsDGVydmVyAIQMBToAgjgJAIQFBXJpZ2h0IG9mICIAGQsiOiAuLi4KACsLAIEyCgA2CgCBPhlDT05ORUNUAIEgOACDHBEAgUgQbG9vcCByZXNwb25zZSBpbWNvbXBsZXRlPwCEJgUAglUZUkVBRACCZQcgICAgAIJXGQA6CwCBBhYgICAgAIJdG2VuZACDWRsAewsAg0snAIIODVRVUk4gdHJ1ZQCDXhwAhGcKAIcQDGV4aXQAhSQGAIURFwCGah06IGJ1ZmZlciBVU0VSAIZQE1dSSVRFAIY4LAArBgCGHBcAhlAWAF4FAIgzFQCDVwUoKjEpAIgpJHNlbmQAgUEGAIg7CQCERggAh0WBAACBPgYAiBgyV1JPVEUAg1eDGgCNfBcAhksmUEFTUwCFLigAJwUAhTAmAJAjCgCITwcoZnJvbQCPZwUgYWN0b3IAhG4aAI0gCwCQcwUiCg&s=modern-blue
should be a complete walkthrough of what happens