AltME: R3 Protocols

Messages

GrahamC
Pekr, you forget so quickly!
BrianH
As do I :)
GrahamC
to sys/make-scheme
and it should work. I did test it a week ago to confirm this.
Pekr
Graham - I do remember VERY well in fact :-) But I was not sure it is recent and working with latest R3 releases. I would really like R3 to accept some protocols as standard ...
GrahamC
the work I was doing recently was turning these old efforts into synchronous forms as in R2
I have this unanswered question on how to deal with network timeouts http://stackoverflow.com/questions/14555961/how-to-handle-timeout-periods-in-rebol-3-schemes
that I need answered.  I'd like some automatic way for tcp to update the waitlist somehow so that if network activity is occuring, the port should not timeout.
any takers?
In R2 you just increase the system timeout value prior to starting your network call
Does everyone remember the old spinning text with network activity from Rebol1 ?
Maxim
IIRC you can still do it in R2.

Rebolek
I have troubles using async mode on schemes. I have my awake handler and I return TRUE on 'read event, but the WAIT doesn't return and waits until timeout. Any ideas what am I doing wrong?
GrahamC
can you break it down into the smallest example?  AFAIK, true at the end of the event loop should cause you to leave it
Rebolek
This should be it. It waits until timeout and then returns data:
send-redis-request: func [port] [
    write port #{2A330D0A24330D0A5345540D0A24390D0A6173796E63746573740D0A24340D0A747275650D0A}
]
read-redis: func [
    "Async HTTP reader"
    url [url!]
    /local spec port
][
    spec: probe decode-url url
    spec/2: to-lit-word 'tcp
    port: open spec
    port/awake: func [event] [
        ;print ["Awake-event:" event/type]
        switch/default event/type [
            lookup [open event/port]
            connect [send-redis-request event/port]
            wrote [read event/port]
            read  [
                print ["Read" length? event/port/data "bytes"]
                read event/port
            ]
            close [return true]
        ] [
            print ["Unexpected event:" event/type]
            close event/port
            return true
        ]
        false ; returned
    ]
    port
]
print "REDIS reading..."
rp: read-redis tcp://192.168.211.10:6379
wait [rp 10]
close rp
print to-string rp/data
It's adapted from the HTTP example where it works fine, but with another scheme I can't get it to work.
GrahamC
Sorry, does the above work or not?
Rebolek
It sort of works. Request is send and response is read back but instead of returning immediately, it waits for timeout. The HTTP example from rebol.net wiki returns immediately.
GrahamC
read  [
                print ["Read" length? event/port/data "bytes"]
                read event/port
            ]
Here you need to print the event data and return true .. not read again
You are timing out because you are attempting to read again from the port when no more data is coming
Rebolek
So why does it work in HTTP example?
Also, changing the READ code to:
            read  [
                print ["Read" length? event/port/data "bytes"]
                true
            ]
does nothing. It still waits until timeout.
GrahamC
the http protocol uses two event engines .. it's complicated
Does it print any data?
Rebolek
yes, it prints instantly and then waits 10 seconds.
GrahamC
change that to . return true and not just true
you still have false at the end of your loop
Rebolek
Wow!
Oh, I see...
Thanks, Graham!
GrahamC
Or, restructure your loop the same way as I did
NP .. still waiting on text-table and text-list fixes :)
Rebolek
I know, I''m sorry...I'm spending too much time with Redis ;)
Bt with async (almost) working I guess I can move from it for some time and fix the styles :)
GrahamC
Anyway, I thought I explained this in my tutorial .. I need to look again to see what I wrote
in case it's not clear enough
Rebolek
Is there some new version? I remember there was only SYNC-WRITE.
GrahamC
No new tutorial yet .. there was an attempt to expand it .. but that has stagnated
always a problem with committee approach lol
Rebolek
Hm, the simple example works, but trying to put it in scheme does nothing yet...
GrahamC
is your redis:// on github yet?
Rebolek
Yes, but not the async part yet.
GrahamC
want to give us the gist ?
Rebolek
I use this for testing the async version:
do %prot-redis.r3
async-handler: func [event /local port] [
    port: event/port
    print ["==TCP-event:" event/type]
    ;print ["Awake-event:" event/type]
    switch/default event/type [
        lookup [open event/port]
        connect [
;           send-redis-request event/port
            write event/port event/port/locals
        ]
        wrote [read event/port]
        read  [
            print ["Read" length? event/port/data "bytes"]
            return true
        ]
        close [
            event/port/spec/port-state: 'closed
            return true
        ]
    ] [
        print ["Unexpected event:" event/type]
        close event/port
        return true
    ]
    false ; returned
]
rs: redis://192.168.211.10
rp: make port! rs
rp/awake: :async-handler
open rp
write rp [SET asynctest true]
probe wait [rp 3]
GrahamC
is the link, this tcp-port/spec/port-state: 'ready should be 'closed or something but that's not the issue
connect [
;           send-redis-request event/port
            write event/port event/port/locals
        ]
Doing two consecutive writes?
Rebolek
No, the first one is commented.
GrahamC
oh ...
Rebolek
It's bit messy...
GrahamC
yeah ..
you have
port: event/port
but then still do write event/port
Rebolek
yes, but it shouldn't be problem, no? It's copypasted from two different versions...
GrahamC
It looks good to me .. but I only just woke up
Rebolek
It prints "Read 5 bytes" and then waits until timeout. [Return true] is there so I guess it should work. But it doesn't :/
GrahamC
why are you not using the port returned by 'open?
Rebolek
you mean like [rp: open rp]  ?
I copied that code from the example on rebol.net
GrahamC
you return the newly opened port .. so I thought you'd use it ?
Andreas
Bolek, you don't install an awake handler on the TCP subport.
In line 400, you explicitly clear the awake handler on the TCP subport:
https://github.com/rebolek/prot-redis/blob/master/prot-redis.r3#L400
So I don't think the awake handler you install on the Redis parent port (the example you pasted above) will be called at all.
GrahamC
so, you need to get the port returned by open and install the async handler on that
Andreas
Right.
GrahamC
I was getting there ... heh
Rebolek
But  READ in ASYNC-HANDLER gets called.
Andreas
Are you absolutely sure about that?
Rebolek
I changed the line 400 to [tcp-port/awake: :redis-port/awake] and it's still the same.
Andreas: PRINT prints in console, so I guess it should.
Andreas
And it prints even without setting the subport's awake?
GrahamC
rp: open redis://192.168.2.11:10
rp/awake: :async-handler
write rp [ SET asynctest true ]
wait [ rp 3 ]
does that do anything?
Andreas
(Warning: IP address mangled.)
Rebolek
Graham, this prints "Read 5 bytes" and the wait for 3 seconds.
the=then
GrahamC
In your write actor you rewrite the event handler I think
Rebolek
I guess this should put the async-handler into tcp-port, no?
GrahamC
anyway getting too complicated for me ...
Rebolek
This ASYNC write is old code that doesn't work, it uses some non-existent functions
GrahamC
I mean if you already set up a hander, why are you rewriting it ?
Rebolek
I set up the handler for the redis-port and here it's moved to the tcp-port
It's probably copied from some example.
From the HTTP protocol.
GrahamC
maybe
redis-port/state/awake: :port/awake
should be
redis-port/state/awake: :redis-port/awake
because in our write actor, there is no 'port defined
our => your
just guessing now ... must have breakfast!
Rebolek
I changed the Async part of WRITE to:
            ;  --- ASYNCHRONOUS OPERATION
                unless open? redis-port [cause-error 'Access 'not-open redis-port/spec/ref]
                tcp-port: redis-port/state/tcp-port
                either probe tcp-port/spec/port-state = 'ready [
                    write tcp-port to binary! make-bulk-request data
                ][
                    tcp-port/locals: to binary! make-bulk-request data
                ]
And I setup tcp's awake in OPEN, but the result is still the same, it prints and then it waits.
Ok, breakfast is important! :)
Rebolek
I pushed latest version to GitHub together with %async-test.r3 so ou can look at the version I'm using here.
Andreas
Do you have the console print output you get somewhere gisted?
Rebolek
just a moment...
There's wait after "..Read 5 bytes"
Andreas
mhm
Rebolek
exactly...

GrahamC
don't know what's current but this line should be
https://github.com/rebolek/prot-redis/blob/master/prot-redis.r3#L250
tcp-port/spec/port-state: false or none
GrahamC
could be
tcp-port/awake: :awake-handler
so, your example could be
rp: open redis://192.168.2.11:10
write rp [ SET asynctest true ]
wait [ rp 3 ]
Rebolek
This doesn't help, it's still stuck in the wait loop, even with the change from ASYNC-HANDLER to AWAKE-HANDLER.

Rebolek
During redis:// test I crashed Rebol with "#9910: unspecific" error. I'll try to isolate the problem (but I guess it needs lots of reads and writes on TCP port). Has anybody seens this error before?
GrahamC
I've seen unspecific errors before but never recorded which ones

Rebolek
How can I read multiple TCP responses to one request? When I WAIT on port, I get first response and I can see with Wireshar other responses were sent also, but how do I access hem from Rebol?

Cyphre
Rebolek: I guess you need to implement your own awake handler for that.
(You might also check here for some tcp examples: http://www.rebol.net/wiki/Port_Examples#TCP_Network_Examples)
Rebolek
I'm writing my own awake handler for this, I just don't know how should to deal with his situation :)
his=this
Cyphre
hmm, not sure what is the problem...you should be able to handle that situation using the READ/WROTE events, no?
Rebolek
So should there be some loop in READ event?
something like until some-mysterious-condition [copy port/data] ?
Cyphre
I think first you need to know how much you read already, how much is left to read, if you are at the end of the response or not etc. and build logic around that in the awake handler. What protocol are you trying implement?
Also look at the examples...I don't remeber it from my head directly but you can either read or write on the port from the READ event depending if you want to wait for more data or send something to the server etc. It all depends on the protocol definiton.

Gabriele
Rebolek, IIRC you just call READ again on the port if you want to read more in the 'read event. That will trigger a new 'read event once new data is ready. You should check existing examples (eg. HTTP), I don't know what the state of the documentation is.

Rebolek
Gabriele, Cyphre, see this gist. https://gist.github.com/rebolek/8858338 It returns first line but when I call read again it just waits and does nothing.
Gabriele
What I meant is, that in the 'read event:
    read [
        port/spec/data: copy port/data
        clear port/data
        return true
    ]
you need a way to know if more data is needed (or, simply assume more data is always needed) and call read again, eg:
    read [
        port/spec/data: copy port/data
        clear port/data
        read port
        return true
    ]
this will trigger a new 'read event where you call COPY again etc.
This is from memory so I might be wrong.
Gabriele
For example, in the HTTP scheme, in the 'read event I call the check-response function, which determines if more data is needed (do we have all the headers? do we need content data? etc.) and calls READ on the port accordingly.
actually, I think that returning TRUE from the 'read event means "we are done, no more data to read", which signals the higher level READ to return your data. But, I might be wrong here, I don't remember the details.
Rebolek
Ah, OK, so calling READ from READ. I will try that. Thanks.
Cyphre
Yes, I think Gabriele is right...you need to call READ action from READ event. AFAIK you can also WRITE on port from READ event to send some data to server if necessary...etc.  It depends on the protocol spec/logic you need to follow.

Bo
GrahamC: I was trying to use your excellent FTP protocol for R3 from https://github.com/gchiu/Rebol3/blob/master/protocols/prot-ftp.r, but I am getting an error when I am trying to read or load:
>> read ftp://user:pass@ftp.sonic.net/
** Script error: cannot access state in path port/state/connection
** Where: read
** Near: read ftp://user:pass@ftp.sonic.net/
>> load ftp://user:pass@ftp.sonic.net/
** Script error: cannot access state in path port/state/connection
** Where: read either read-decode case load
** Near: read source if find system/options/file-types type [data: de...
I was wondering if this is a known issue or a regression?
The same port/state/connection error shows up when trying to write a file as well.
Bo
This is with the latest Windows build downloaded today from http://rebolsource.net.
NickA
Bo, you need to use the FTP protocol commands to read or save (you can't do it directly with 'read, 'write, 'load, etc.).  There are some working examples at  http://learnrebol.com/rebol3_book.html#section-7.9 and http://learnrebol.com/rebol3_book.html#section-7.10
Bo
Ah, thanks for that, Nick!
GrahamC
Yes, synchronous mode working on a url is not currently supported.  You need to work with a port!
Never got round to finishing the protocol.
There was no interest in 2010 lol
But I think it's easy enough to wrap them into a synchronous function

amacleod
Getting an eror trying to open ftp port using prot-ftp.r
cmd: open decode-url ftp://user:pw@majorityreporttv.com
Script error: net-log has no value
Where: open
GrahamC
doesn't use 'decode-url
amacleod
Will try again Graham, Thanks. I was working from NIck's tutorial...

amacleod
Graham, similar error.
cmd: open ftp://user:pw@majorityreporttv.com
Script error: net-log word is not bound to a context
Where: open
I'm doing: do prot-ftp.r or is it a module that should be included in needs[]: ?
Not up to speed with R3...
GrahamC
Looks like module handling has changed since I wrote this.
Bo has been using this ... Bo?
GrahamC
Just tried it and I don't get that error.  Are you using latest rebol3 ?

Luis
Version:   2.101.0.3.1
  Platform:  Windows win32-x86
  Build:     14-Aug-2013/14:51:03
>> do %prot-ftp.r
>> cmd: open ftp://user:pw@majorityreporttv.com
port opened ...
>>
amacleod
Version:   2.101.0.3.1
Platform:  Windows win32-x86
Build:     14-Aug-2013/14:51:03

>> do %prot-ftp.r3
Module: "Rebol 3 FTP scheme" Version: 0.0.92 Date: 10-Jan-2010 24-Feb-2013
>> cmd: open ftp://user:pw@majorityreporttv.com
** Script error: net-log word is not bound to a context
** Where: open
** Near: open ftp://user:pw@majorityreporttv.com
Version:   2.101.0.3.1
Platform:  Windows win32-x86
Build:     14-Aug-2013/14:51:03
GrahamC
>> rebol/version
== 3.0.0.3.1
>> do %prot-ftp.reb
Module: "Rebol 3 FTP scheme" Version: 0.0.92 Date: 10-Jan-2010 24-Feb-2013
>> cmd: open ftp://user:pw@majorityreporttv.com
port opened ...
You're using an ancient version of Rebol3
Download latest from rebolsource.net
amacleod
Version:   2.101.0.3.1
Platform:  Windows win32-x86
Build:     4-Mar-2014/4:53:51
Same version#???
Same error too....
>> do %prot-ftp.r3
Module: "Rebol 3 FTP scheme" Version: 0.0.92 Date: 10-Jan-2010 24-Feb-2013
>> cmd: open ftp://majorityreporttv.com
** Script error: net-log word is not bound to a context
** Where: open
** Near: open ftp://majorityreporttv.com

GrahamC
Then I don't know because it works for me and others
DideC
Try to put R3 in a different folder and try again.
Or maybe your prot-ftp file has been modify in some way?
Kaj
Isn't 3.0 the Atronix version?
2.101 is the official or community version
GrahamC
Yes, Atronix version ... but everyone else is using different versions and it works
Kaj
Well, Alan's version is not ancient

GrahamC
The times I have seen this _not bound to a context_ error is I think when something has not been defined as a local in module before it is then used.
Alan's first version he was using was from Aug 2013 which is pretty old is it not?
Kaj
Hardly ancient I would say
GrahamC
Do you have any suggestions as to why he is getting this error?
amacleod
I re downloaded prot-ftp and it now works...I do not remember where I first downloaded from but it was not from git hub ...may have a bad version out there somewhere...
Bo
GrahamC:  Using FTP with R3 is on my list of projects, but I haven't actually had a chance to work on it.  Been too busy with the several dozen other projects I'm involved in right now. :-\
Luis
Someone works with FTP on Android ?
Luis
The same program run in Windows but no in Android. No errors only get
port opened ....
GrahamC
@amacleod .. the error you saw was a result of a change in modulel handling and the version on github was supposed to correct it.  So, likely you just had an old version around.
GrahamC
@Luis .. I've not tried ftp on Android.  Do the other protocols works?
Luis
Http, but no support redirection . (OK ww.rebol.com and error with www.google.com)
Luis
I am testing https://github.com/gchiu/Rebol3/blob/master/protocols/prot-ftp.r on rebol/build 12-jul-2013/19:02:11
GrahamC
http protocol doesn't support that degree of redirection on any platform
Luis, can you describe exactly what you tried on android?
GrahamC
I can't see any obvious reason why ftp shouldn't work if http works
Luis
Only change line 583 of ypur code pointing it to another ftp host . Tested without problems with Android ftp apps  and same R3 code OK on Windows.
GrahamC
And did you try any other ftp host?
Luis
Nop
Luis
Only testing on www.byethost.com  (free hosting)
Luis
same result on 000webhost.com. On Android only get  first line: "port opened ...". No problem  on Windows.
GrahamC
Which android version is this?
Luis
Android 4.3 Note II
GrahamC
Sorry, which version of Rebol3 android?  Is it r3/droid or is it another version?
Luis
From Saphirion  rebol/build 12-jul-2013/19:02:11
GrahamC
All the 'read does is to kick off the awake handler
it should then do the 'lookup so if you remove the comment https://github.com/gchiu/Rebol3/blob/master/protocols/prot-ftp.r#L238
Sounds like from what you're saying, it's not even getting to https://github.com/gchiu/Rebol3/blob/master/protocols/prot-ftp.r#L234

Luis
Exactly
GrahamC
so, you do
cmd: open ftp://site.name
and then
wait cmd
and it just hangs?
Luis
read cmd return none but wait cmd advance to login  !!
GrahamC
that's odd .. sounds like it's waiting on the wrong port then
Luis
If change "read cmd"  by "wait cmd" The last lines are:
C:  PASS mypsw
===Client event: wrote
wrote to port, now read from it
=== Client event: read
Coffe time with my wife, returning in 40 minutes....
Luis
Adding  "wait 0" lines  after each "read cmd"  I can get the htdoc dir (sometimes hang) .
GrahamC
I'm afraid it's alpha level software
The 'read should be doing the 'wait on the correct port
that it's not is odd ...
especially if it works on other platforms
Luis
Apparently sometimes hangs for some seconds, finally reach the end.
Is good for me.
Thanks !
amacleod
I believe this is where I got the prot-ftp.r script originally: https://github.com/gchiu/Rebol3/tree/master/protocols
Should be changed...
Never mind that links to same version...

Cyphre
Not sure if this it the case but in current R3 you have to wait on the port that operates on the real connection (usually tcp scheme). If you wait on the 'topmost' port used by some higher-level scheme the real 'connection port' will be awaken but not the 'topmost' one.
To solve this annoyance, we probably need to introduce new field to the port object (like port/parent-port) using which the AWAKE handler can find the top-most port easily and resolve correctly waiting on higher-level scheme wrappers.
GrahamC
I'd like to use the term socket to indicate the real tcp-level port to ease the terminology confusion here.  And yes, the ftp protocol does do a wait on the socket.  It works fine in other OS, just not Android according to Luis' tests.

GrahamC
@Luis .. I think the issues you were having with ftp protocol on Android are related to the alpha event handling on Android.
Cyphre could confirm.
Cyphre
Graham, it could be...Luis, if you have any simple test script (preferably using some free test ftp account so I don't need to create one) I could quickly try here to see what's goign on.
Luis
Cyphre: I am using http://www.byethost.com/ (you can register using  www.10minutemail.com  ) only need change line at https://github.com/gchiu/Rebol3/blob/master/protocols/prot-ftp.r#L583 .

GrahamC
I'd like to modify the http protocol so that I can do this
page: write http://www.rebol.com [ headers GET / ]
so that I return the headers and body.  Any thoughts on this?
Obviously the main idea is to be able to grab the cookies.
If people think this is worthwhile, I'll make a PR on one of the Rebol3 repos that is being actively maintained
Maxim
I think its a good idea (actually, almost essential in today's web environment) .
Maxim
when doing a successive read, there should also be a transparent way to modify and re-submit the same cookies... say, by adding a cookies attribute to the http port and maybe a few functions for modifying them (add, redate, update)
Cyphre
Luis, thanks...will give it a try hopefully soon.
GrahamC
@Maxim, I can't see how you'd do this using successive reads since the http protocol doesn't preserve state.  and currently if you open a port, you lose access to the write dialect.

GrahamC
write http://www.rebol.com [ HEAD / ]
now returns the last modified date correctly
Added a 'headers keyword in the write dialect to return the headers
page: write http://curecode.org/rebol3/view-tickets.rsp [ headers GET / ]
page/spec/debug/headers will now contain the headers for the page returned, including the cookies
and page/data will contain the web page data
Rondon
Hi Folks, How can I  use the https using R3. I'm using the saphirion Core distribution. Any tips?
I was using Rebol Commnad before but now I'm receiving the error .
Command Error: SSL error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Rondon
I'm on Ubuntu linux 12.04 distro.

GrahamC
So, are you saying Rebol/command has stopped working?

Rondon
it hasn't stopped working, but https couldn't work on SSLv3
I saw your github with r3 protocols, do you have plans for https? I'm gonna try a workout using Curl from rebol.
to handle https
GrahamC
current versions of rebol3 from Saphir and Atronix have https
Rondon
ok.. I'll try this

Bo
I'm trying to run prot-pop3.r3, but I get an error:
make-scheme has no value
Is there something I need to run first?  I'm running the latest dev release from Atronix for ARM.
Bo
What I'm trying to do is access gmail email from R3.  It looks like SSL has to be used to get email.  Has anyone tried downloading email from gmail with R3?
Josh
Bo, sys/make-scheme  ?

Bo
Thanks for the suggestion, Josh!  I downloaded Graham's prot-spop3.reb and Gabriele's fsm.r (which I renamed fsm2.r as I couldn't find an fsm2.r - it seemed to work without error).  It appears to be able to open two different POP3 mailboxes, but both of them show 0 messages even though I know they both have messages in them.
Josh

Bo
Josh, that's the one I tried.  Thanks!
Josh
I guess you'll have to check with Graham.  I believe he has said his protocols were completed
Bo
It looks like part of the problem I'm having with spop3 is that it doesn't throw up an error when there is no mail server on the other end, or if the settings are incorrect.

Bo
OK.  So there is a bug with the ARM version of R3.  I tried the Atronix latest branch and a version from 2013.  Both had the same problem.  Both always show that there are no messages in the mailbox when using any version of pop, spop, or imap.  The exact same script with the exact same credentials on a version of R3 from Feb 2014 works fine on Windows.

Robert
Has anyone ever tried to re-activate / port Rebol Services to R3?
I liked it a lot but lost track about its state and which problems and things are still open.
Kaj
R3 chat is based on a successor
So the design is still in limbo and the code missing in action
I use 0MQ instead
Robert
Is the R3 chat service stuff published and documented a bit?
Pekr
R3 Chat is imo in no way a successor. When I talked to Carl, he wanted to rewrite Rebol/Services to eventuallly simplify some concepts, etc.

Kaj
Yes, and he did that in R3 Chat. He said the interface collapsed in such a way that he didn't think tthe REBOL/Services concept was needed anymore
The chat client code is available because it is downloaded, but as far as I know, the server was never published
Carl's ideas were all in flux, so there is no documentation, either
DideC
I know it was ask to him several times, but it would be cool to ask again : "please, can you give us the server code !"
Pekr
Other than that, Rebol/Services section is still available - http://rebol.com/docs/services/
hmm, abbreviating Rebol/Services to R/S now clashes with how we refer to Red/System :-)
Robert
Thanks. This sounds like a lot of reverse engineering and doing it once again.

DideC
I feel sad everytime this simple things are broken. There is no more service.r available :-(
Even the client download is dead link.
Rondon
GrahamC, How can I used https and post using prot-http.r3
how do I pass the parameters? it doesn't accept read/custom

GiuseppeC
Programmers do not write documentation !
Rondon
I just want to know how to refine the 'read command using prot-http.r3.
using R2. I just use read/custom https://example.com ['post "field1"  "valuefield1" ]
this is not working with prot-http.r3.   it really works https scheme, using read https://example.com ,  but I need to post data, and GET is the default method. I just want to use the POST. Any tips?
Andreas
To POST, use WRITE.

Gregg
Like Kaj, I've decided 0MQ is a better way to go at this point.

Robert
Taking on this, I'm a bit fan on the BEEP protocol building framework. It offers some higher level features thatn 0MQ.
I always thought it's a very cool (maybe even a killer feature) to build such an application protocol framework right into R3. So, when you want to do P2P, Client/Server etc. and use R3 on both ends, you just use this BEEP stuff and all networking problems are gone.
I'm still convinced that it makes a lot of sense.
Pekr
That was also kind of idea of Uniserve, upon which Cheyenne is built. Maybe a bit inspired in Python's Medusa. All protocols are hot plugs IIRC. I too think, that some kind of general mechanism, upon which various (app) protocols could be built, would be fine. In that regards, I found R3 Chat being a step back, not forward ...
Robert
And I wouldn't do all the low-level stuff in Rebol but on the C side.
Gregg
Didin't Ladislav write BEER a long time ago?
Robert
Yes, in Rebol. With a lot of problems.
I don't know if it was standard conform or just a fork of the idea.
Gregg
I don't either. Probably have an old copy somewhere here. Lad's stuff has been offline for a while I think.
Gregg
I think I liked the idea of a way to build protocols like PARSE lets us build DSLs, but never got it to stick for me.
Pekr
I would not try to overcome port mechanism, whatever it takes. If there are bugs, those should be fixed. Well, it might be an extension (which is C). We will see, how Red IO turns out, once out ...

Robert
I don't like to port model that much. Might be because I never digged deep enough into it. But trying to generalize IO with a common API or model was tried in several other enviironments and all I know failed.
IMO putting network stuff to a higher level makes sense. Much higher level so that I can think of it in sending things back and forther and that's it.
Gregg
Have you looked at 0MQ? It's basically send/receive, with socket types that have semantics (req/rep, pub/sub, push/pull).
Kaj
0MQ looks like that on the surface and in the marketing, but when you start making real systems, you have to do a fair bit more
The problem with those network abstractions is that there quickly are reasons you have to poke under the hood

Gregg
Have you found something better? It's all about tradeoffs, right?
Maarten
Now I'm tickled
Gregg
Kaj, maybe I should ask, instead, what poking under the hood you've had to do. I'm not stressing 0MQ in my work (very low message rates, largely for IPC), but some other work I did with it a few years ago hit it much harder and was still very easy to do.
Kaj
Most simple examples, and what most people start with, is request/reply, but this quickly becomes useless in real-world situations
To be more flexible and scale it, you have to switch to dealer/router, which means managing and interpreting the multiple parts of request/reply messages, including the under-the-hood identity part
Now you're juggling sub-messages and babysitting their consistency, and soon you have to manage the internal sub-messages by creating, copying and destroying them, and comparing their content
First you think, ZeroMQ is about queueing, so I don't have to make my own message queues anymore, but again that only works in the simplest examples
When you need more flexibility and performance, you're back to maintaining your own message queues, and the 0MQ queues become a hindrance, because you can't access them once a message is in there
Kaj
I'm probably spoiled because I never worked with earlier, complex messaging systems, but this is my experience
It would also be different if you're working with low-level languages, but in REBOL/Red a message queue is easy to do, so why give up control over it?

Pekr
Kaj - having your experience with ZeroMQ - what do you think about the Rebol/Services architecture? Is it any better in organising more higher (app) level stuff, than starting with low level ZeroMQ stuff?
Robert
I see BEEP at a much higher level than 0MQ. It's for application developers, you care about the application protocol not the technology below. Here is an even higher-level lib build on top of BEEP: https://www.tml-software.com/
Kaj
Petr, I just happened to review REBOL/Services again with the hindsight of 0MQ experience
It's amazing how Carl solved all the same problems at around the same time 0MQ was designed
Also, a lot of stuff that was traditionally missing from 0MQ is in R/S, such as encryption and authentication
On the other hand, both fail to provide the first needs most people have: an HTTP transport that is able to traverse firewalls is missing from both
Further, R/S manages to cripple its added value of encryption by only providing cloaking in the free version, and requiring paid versions for real encryption that you can't even order anymore
R/S is much nicer and quicker to program because it's all REBOL, but 0MQ's point is the reverse: that it's language neutral, which is also very powerful
Gregg
They target two entirely different problems. Hard to compare them. And R/S does have the CGI option.

Kaj
I see a big overlap between them
Gregg
LNS (R/S) is high-level dialected req-rep (not always RPC) over, theoretcially, any transport and is point-to-point client-server. 0MQ is mid-level sockets with semantics. Mid-level meaning framed messages, multiple connection points, brokering/proxying, buffering, etc. LNS also has the concept of an admin interface and file sharing, but those are incomplete AFAIK.
I like both, but they are very different to me. I LOVE the idea of a completely native REBOL solution, but 0MQ opens the door to interacting with other systems.
Gregg
And we should be able to use 0MQ as just another transport for LNS, right?
Kaj
Yes, 0MQ is leaning towards transports, while R/S is leaning towards defining message formats. In the middle, they overlap
Looking at R/S in terms of 0MQ, it's not completely clear what R/S offers, but it looks like it's more like 0MQ dealer/router than request/reply
0MQ's flexible other topologies are not offered by R/S, so it's a matter of viewpoint which one would be considered more high level
When you need them in R/S, you'd have to implement them yourself on top of R/S's sort-of dealer/router

Gregg
How do you see R/S as dealer-router?
Kaj
It seems to be able to overlap multiple requests, which is essential for performance, and also means it needs to maintain internal message queues
However, it doesn't automatically generate node IDs like 0MQ, so it's less convenient in that
Gregg
Ah, OK. And since there is no concept of distributing work, you would have to build all that yourself behind the server.

Kaj
Right

Last message posted 489 weeks ago.