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
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} ]
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.
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.
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.
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.
>> 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.
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?
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.
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.
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?
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.
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 !"
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?
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.