World: r3wp
[!REBOL3 Schemes] Implementors guide
older newer | first last |
Graham 10-Jan-2010 [904] | seems to be according to the docs you linked to |
Steeve 10-Jan-2010 [905] | i should make a try, i have some doubts |
Pekr 10-Jan-2010 [906] | what is it good for? That way you have to read-out all data from buffer first, before you do "reverse" (read/write) operation, or you mess the data, no? |
Graham 10-Jan-2010 [907x2] | yes, copy all your data first before doing a write |
store it in port/locals somewhere | |
Pekr 10-Jan-2010 [909] | it sounds to me as an unnecessary complication. I don't like it. But maybe Carl tried to create push on programmers, pushing them to do sequency of read/write correctly? |
Graham 10-Jan-2010 [910] | seems like a lot of overhead too ... |
Steeve 10-Jan-2010 [911] | i tested. Alternating read/write causes the buffer cleared each times |
Graham 10-Jan-2010 [912] | so the docs are correct |
Steeve 10-Jan-2010 [913] | But the buffer is cleared only after a write action occured . If you receive several read events the data are added to the buffer (buffer not cleared) |
Graham 10-Jan-2010 [914] | Yep, I think that's what I said above |
Steeve 10-Jan-2010 [915x2] | ok, i just confirmed it with tests |
i encountered the famous stack overflow bug. Never never use a [wait] when you treat an event in the awake handler | |
Graham 10-Jan-2010 [917] | I see in Gabriele's prot-http he has an http-awake handler that creates events which he passes on to another awake handler |
Steeve 10-Jan-2010 [918x2] | yes but it"s fake events passed from tcp port thru the fake http port. Actually, it's just calling the event handler function of the fake port |
it's not asynchronous | |
Andreas 10-Jan-2010 [920x4] | it's a pity that we have to "fake" these events, currently |
I'd love to be able to pass "real" events on, WAKE-UP would already be there, but other stuff seems to be missing | |
i tried sending with WAKE-UP from the tcp port to the scheme port, and the scheme port's AWAKE handler even got called | |
but a WAIT on the scheme port never returns, even though the scheme's AWAKE returns true | |
Graham 10-Jan-2010 [924x4] | anyone can test this http://rebol.wik.is/Rebol3/Schemes/Ftp |
the default timeout times out waiting for ftp.debian .. so I put a wait 10 seconds there! | |
I was trying to find a ftp site with a lot of data to read from ... | |
I may have some redundant waits there in the handler | |
Andreas 10-Jan-2010 [928x2] | try /debian/pool/main/x/ instead of /debian/dists/lenny/ |
that should give you a huge directory listing :) | |
Graham 10-Jan-2010 [930x2] | ok |
eeek... r3alpha crashed on me :( | |
Andreas 10-Jan-2010 [932] | heh :) |
Graham 10-Jan-2010 [933x5] | yeah ..doesn't get a complete directory listing ... |
something must be wrong in my dataport event handler | |
missing a read port in the read event | |
only picks up 5355 bytes | |
I can pick up the rest doing a read cmd | |
Andreas 10-Jan-2010 [938] | sounds like it should be |
Graham 10-Jan-2010 [939] | ... |
Andreas 10-Jan-2010 [940x6] | i think with PASV you should just re-read on the data port until the port is closed, no? |
i just tried a bit from the console | |
i got LIST reponse for /debian/pool/main/x with two read events | |
first returned 32000 bytn | |
bytes* | |
second appended another 13901 bytes | |
Graham 10-Jan-2010 [946x2] | Does the server always close the dataport after sending data? |
if so I can keep trying to read until the port is closed | |
Andreas 10-Jan-2010 [948x2] | yes, that's how PASV works, as far as i know |
client sends PASV, gets a port number, connects to that port | |
Graham 10-Jan-2010 [950] | client/spec/dataport/awake: func [event /local port] [ port: event/port print ["==TCP-event on dataport:" event/type] switch/default event/type [ read [print ["^\read:" length? port/data] print to-string port/data clear port/data read port ] wrote [read port] lookup [print query port open port] connect [read port] close [ ] ][true] ] |
Andreas 10-Jan-2010 [951] | yep |
Graham 10-Jan-2010 [952] | so this is my data port handler .. |
Andreas 10-Jan-2010 [953] | if you really want to collect the response, drop the CLEAR |
older newer | first last |