r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

Andreas
10-Jan-2010
[922x2]
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
[953x2]
if you really want to collect the response, drop the CLEAR
and then store port/data away in the close event
Graham
10-Jan-2010
[955]
let me try that
Andreas
10-Jan-2010
[956x2]
you'll have to do a PASV before each new request
to avoid that, there was APSV ("all passive"), dunno how support 
for that is
Graham
10-Jan-2010
[958]
Still needs two reads
Andreas
10-Jan-2010
[959]
yeah, that's ok, no?
Graham
10-Jan-2010
[960x2]
switch/default event/type [
												read [print ["^\read:" length? port/data] 
													read port
												]
												wrote [read port]
												lookup [print query port open port]
												connect [read port]
												close [ print to-string port/data]
											][true]
so keep reading until the port is closed ...
Andreas
10-Jan-2010
[962x2]
exactly
well, gotta run now. good luck!
Graham
10-Jan-2010
[964x2]
ok,
they must be sending me two lots of data
Andreas
10-Jan-2010
[966x4]
40k+ for the LIST in pool/x
a good test :)
and it's good to know that data is appended
saves me the separate buffer in my pop3 prot
Graham
10-Jan-2010
[970]
and the buffer keeps expanding too
Graham
11-Jan-2010
[971]
Using a timeout value, largish, I can read a 5000 file listing in 
a ftp directory.  Posted latest code.