World: r3wp
[!REBOL3 Schemes] Implementors guide
older newer | first last |
Graham 6-Jan-2010 [230] | Looks like everything is opened in binary mode as there are no refinements yet to 'open. So, to implement a line oriented protocol like pop, do we read until we get a CRLF pair? |
BrianH 6-Jan-2010 [231x3] | I am reviewing the networking code now, in my available time. |
Yes. | |
There won't be a string-mode refinement to open. | |
Graham 6-Jan-2010 [234x2] | shame .. |
so used to doing read/lines on a text file | |
BrianH 6-Jan-2010 [236] | OPEN has the refinements it is going to have. The port model of R3 is lower-level than R2. Higher-level stuff is handled in the schemes. |
Andreas 6-Jan-2010 [237] | read/lines is already there in R3 |
BrianH 6-Jan-2010 [238x3] | READ is going to have a /text refinement, but not OPEN. |
OPEN is lower-level than READ. | |
Sorry, READ/string, not READ/text (I forgot the proposal was renamed). | |
Graham 6-Jan-2010 [241] | The daytime:// protocol must be the very easiest to implement ... how would that be done under R3? |
Graham 7-Jan-2010 [242] | Gregg you haven't finished the docs on schemes in the wiki ! |
Gregg 7-Jan-2010 [243] | I'm sure there was a reason Graham, or I just forgot, or... |
Graham 7-Jan-2010 [244x4] | hehe .. |
It looks like termites have been thru it http://www.rebol.net/wiki/Schemes:Notes | |
so many gaps in it | |
If Carl wants community involvement .. the docs need to get better .... | |
Maxim 7-Jan-2010 [248] | docs are PART OF community involvment. |
Graham 7-Jan-2010 [249] | Name one person in the community who could write this document ... |
Maxim 7-Jan-2010 [250] | sorry I should have put a bit more meat in my message... this doesn't apply to this specific page but to all of REBOL documentation (especially R3). There doesn't seem to be anyone interested in taking charge of the documentation. AFAICT, I'm not sure people realize that Carl does expect the community to be a big player in the documentation. this is more a constatation than criticism. I don't know how it plays out in Open source language communities, but it seems to me that there is always a little gang which ends up being the documentation krew... seems we lack this fiber in our community. |
Steeve 7-Jan-2010 [251] | Graham, a scheme less guy |
Maxim 7-Jan-2010 [252x2] | but a few of us could contribute to schemes... a few of us have actually written schemes... there also was a great tutorial on rebol forces about schemes. maybe that could be used as the basis for this page. |
note ... this is an R2 page. | |
Graham 7-Jan-2010 [254x4] | Note, I referenced a R3 page on schemes |
This is hereby declared a R2 free zone | |
I've had a go at this the simplest of schemes and can't get it working ... http://rebol.wik.is/Rebol3/Schemes/Daytime | |
I grabbed stuff from Carl's demos and Gabriele's http protocol | |
Steeve 7-Jan-2010 [258] | it's normal. you don't open any tcp port |
Graham 7-Jan-2010 [259x3] | eh? |
I try this read daytime://time-a.nist.gov | |
It says the port gets opened but the awake function is not triggered | |
Steeve 7-Jan-2010 [262x3] | yes but your actors (open and/or read) must create a tcp port thru the host |
a scheme is only a wrapper above a tcp connection | |
(or upd) | |
Graham 7-Jan-2010 [265] | I know .. |
Steeve 7-Jan-2010 [266] | So you have to do a open tcp://host somewhere in your code |
Graham 7-Jan-2010 [267] | Oh ... I didn't create the port ... |
Steeve 7-Jan-2010 [268] | yes |
Graham 7-Jan-2010 [269] | ok, it will have to wait till my tv program finishes now |
Steeve 7-Jan-2010 [270x2] | give me some minutes, i will write it |
make-scheme [ name: 'daytime title: "Daytime Protocol" awake: func [event /local port] [ print ["=== Client event:" event/type] port: event/port switch event/type [ lookup [ print "DNS lookup" open port ] connect [ print "connected" read port ] read [ close port return true ; quits the awake ] ] false ] actor: [ ;open: func [port [port!]][port] read: func [ port [port!] /local con ][ con: open rejoin [tcp:// port/spec/host ":13"] con/awake: :awake wait con to-string con/data ] ] ] probe read daytime://time-a.nist.gov === Client event: lookup DNS lookup === Client event: connect connected === Client event: read { 55203 10-01-07 07:51:23 00 0 0 282.6 UTC(NIST) * } | |
Graham 7-Jan-2010 [272] | thanks |
Steeve 7-Jan-2010 [273] | you may add a timeout inside the wait. |
Graham 7-Jan-2010 [274x3] | can add it to the spec |
I've updated my effort again ... http://rebol.wik.is/Rebol3/Schemes/Daytime | |
the data is returned deep inside the port object | |
Steeve 7-Jan-2010 [277x2] | weird ! The open function must not return the tcp port, but the fake daytime port. Because if someone try to thing like this. >> port: open daytime://... then >> read port ; ==> the wrong actor is called (not the daytime one). |
it may work currently, because you didn"t add other behavior in the read actor, but it's just fluke | |
Gabriele 7-Jan-2010 [279] | brian: there is no link to wetan, it is in the r3-alpha file share. |
older newer | first last |