waiting on ports
[1/12] from: mattsmac::hotmail::com at: 25-Aug-2003 10:00
I have a series of ports, c. I want to wait on all of them, but I also want
to specify the timeout parameter, 5 seconds. How can I do this? ready:
wait [c 5] does not work.
Matt
[2/12] from: Micael:Gullmes:telenor:se at: 25-Aug-2003 16:41
Hi Matt,
I am not sure if I understand what you mean by a series of ports.
You can specify the timeout for TCP ports using:
port: open tcp:192.1.1.1:5001
port/timeout: 5
I hope this is a start.
Brgds /Micael
-----Ursprungligt meddelande-----
Från: Matt MacDonald [mailto:[mattsmac--hotmail--com]]
Skickat: den 25 augusti 2003 16:00
Till: [rebol-list--rebol--com]
Ämne: [REBOL] waiting on ports
I have a series of ports, c. I want to wait on all of them, but I also want
to specify the timeout parameter, 5 seconds. How can I do this? ready:
wait [c 5] does not work.
Matt
[3/12] from: mattsmac:hot:mail at: 25-Aug-2003 10:58
For instance c/1 is one port, c/2 is a different port, etc. So I want to do
a wait on all of them.
wait c works fine, but I have to wait for the network timeout if there is no
activity on the ports. For a single port you can do a command like wait
[c/1 5] so that it listens on c/1 for 5 seconds. So I want to do the same
thing, but with all of the ports. So the command would be something like:
wait [c 5], but this generates an error.
Matt
Hi Matt,
I am not sure if I understand what you mean by a series of ports.
You can specify the timeout for TCP ports using:
port: open tcp:192.1.1.1:5001
port/timeout: 5
I hope this is a start.
Brgds /Micael
-----Ursprungligt meddelande-----
Från: Matt MacDonald [mailto:[mattsmac--hotmail--com]]
Skickat: den 25 augusti 2003 16:00
Till: [rebol-list--rebol--com]
Ämne: [REBOL] waiting on ports
I have a series of ports, c. I want to wait on all of them, but I also want
to specify the timeout parameter, 5 seconds. How can I do this? ready:
wait [c 5] does not work.
Matt
[4/12] from: maximo:meteorstudios at: 25-Aug-2003 11:01
shouldn't it be:
I do not know how c is built but supposing you did:
c: [port1 port2 port3]
you could:
append c 5 ; add timeout value to block
OR: add timeout directly:
c: [port1 port2 port3 5]
wait c ; call wait on the block
-max
-----------
meteor Studios, T.D.
-----------
Never Argue with an idiot. They will bring you down to their level and beat you with
experience
[5/12] from: petr:krenzelok:trz:cz at: 25-Aug-2003 17:16
Matt MacDonald wrote:
>I have a series of ports, c. I want to wait on all of them, but I also want
>to specify the timeout parameter, 5 seconds. How can I do this? ready:
>wait [c 5] does not work.
>
that is a timeout parameter for your wait loop, not entire port. Your
wait function above returns, if:
- event occurs on port 'c, being it timeout (set by port/timeout: 5),
incoming data, port closure by remote site ...
- if nothing happens, those 5 sec in your block causes escape ... so you
are able to process something else in your main loop ...
-pekr-
[6/12] from: g:santilli:tiscalinet:it at: 25-Aug-2003 17:20
Hi Matt,
On Monday, August 25, 2003, 4:00:02 PM, you wrote:
MM> I have a series of ports, c. I want to wait on all of them, but I also want
MM> to specify the timeout parameter, 5 seconds. How can I do this? ready:
MM> wait [c 5] does not work.
One way is:
wait compose [(c) 5]
or:
wait append copy c 5
You could also add the timeout to your list of ports, like:
append c 5
; ...
wait c
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[7/12] from: maarten:vrijheid at: 25-Aug-2003 17:27
Use wait/all
--Maarten
[8/12] from: patrick:philipot:laposte at: 25-Aug-2003 17:22
Hi Matt,
Have you tested ...
wait append c 5
as wait expects a block of value, not a block of block.
Regards
Patrick
[9/12] from: mattsmac:hot:mail at: 25-Aug-2003 11:32
That works great, but only in the console. Any idea why it wouldn't work in
view?
Matt
shouldn't it be:
I do not know how c is built but supposing you did:
c: [port1 port2 port3]
you could:
append c 5 ; add timeout value to block
OR: add timeout directly:
c: [port1 port2 port3 5]
wait c ; call wait on the block
-max
-----------
meteor Studios, T.D.
-----------
Never Argue with an idiot. They will bring you down to their level and beat
you with experience
[10/12] from: maximo:meteorstudios at: 25-Aug-2003 14:53
There is a function called do-events which launches an empty wait loop (since view creates
an event loop handler, it starts waiting for events, I guess its a port too).
do-events: func [
"Process all View events."
][
wait []
]
you can see that in do-events, wait has no timeout... I am not sure how it ties in with
message port handling...
you might want to open your window with view/only (which does not start event handling)
and then start your own wait with ports and timeout selected, like we were all talking
about...
then any view events will react until the timeout appears and the wait returns... ITHINK
....
at which point you could relauch only a wait [] (to continue with view events, or start
other ports etc)... or pop up a message or whatever... I'm not sure why you need the
timeout...
I cannot test it, but maybe this does not work... in any case, I'll have opened a door
which you or someone else might want to explore...
HTH
-max
-----------
meteor Studios, T.D.
-----------
Never Argue with an idiot. They will bring you down to their level and beat you with
experience
[11/12] from: greggirwin:mindspring at: 25-Aug-2003 13:53
Hi Max,
MOA> you might want to open your window with view/only
MOA> (which does not start event handling)
I think you mean VIEW/NEW.
-- Gregg
[12/12] from: maximo:meteorstudios at: 25-Aug-2003 16:05
yessssss, sorry !!!!
VIEW/NEW
-max
all that talk about files <-> blocks had my mind mixed up ;-)