AltME: R3 Protocols
Messages
Wednesday 5th June, 2013
GrahamC
20:35
Sorry, does the above work or not?
Rebolek
20:37
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.
20:39
HTTP version:
http://rebol.net/wiki/Port_Examples#Use_TCP_to_read_a_page
GrahamC
20:40
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
20:42
You are timing out because you are attempting to read again from the port when no more data is coming
20:44
See this example
https://github.com/gchiu/Rebol3/blob/master/protocols/prot-demo.r#L43
Rebolek
20:45
So why does it work in HTTP example?
20:46
Also, changing the READ code to:
read [
print ["Read" length? event/port/data "bytes"]
true
]
does nothing. It still waits until timeout.
GrahamC
20:47
the http protocol uses two event engines .. it's complicated
20:47
Does it print any data?
Rebolek
20:47
yes, it prints instantly and then waits 10 seconds.
GrahamC
20:48
change that to . return true and not just true
20:48
you still have false at the end of your loop
Rebolek
20:49
Wow!
20:49
Oh, I see...
20:49
Thanks, Graham!
GrahamC
20:49
Or, restructure your loop the same way as I did
20:49
NP .. still waiting on text-table and text-list fixes :)
Rebolek
20:51
I know, I''m sorry...I'm spending too much time with Redis ;)
20:52
Bt with async (almost) working I guess I can move from it for some time and fix the styles :)
GrahamC
20:52
Anyway, I thought I explained this in my tutorial .. I need to look again to see what I wrote
Last message posted 486 weeks ago.