[REBOL] Re: No-wait
From: nitsch-lists:netcologne at: 23-Feb-2004 11:51
Am Sonntag, 22. Februar 2004 20:49 schrieben Sie:
> What is the purpose of no-wait. Doesn't seem work for me. Isn't no wait
> supposed to return immediately.
> For example:
> Shouldn't a forever loop that has the following code always be printing
> instead of only once the port has received data?
> port: open/direct/no-wait tcp://:7000
> x: 0
> forever [
> print x + 1
> x: x + 1
> data: first wait port
> I would like to see it continuously printing the value of x instead of only
> after it receives data on the port. So what does no-wait accomplish?
return what is currently in the buffer.
You want to use [ wait [port 0] ]. this returns when there is data on the
port, or after 0 seconds. If it returns the port, there is data. so
either port = wait [port 0][print "hey data"][print "dumdidumdidum.."]
0 is the wait-value, with [ wait [port 0:0:0.1 ] ] you would print 10* a
second. (maybe you need to redcue, not checked)
> Paul Tretter