I tried play with this with this script while opening another console and
inserting to those ports. I got no expected output. The core docs need to
be updated to explain listening on more than one port.
REBOL[]
port1: open tcp://:55
port2: open tcp://:56
while [true][
wait [port1 port2 0]
buffer1: first port1
buffer2: first port2
print buffer1
print buffer2
]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 16, 2000 10:42 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Port probing Re:
On Mon, Oct 16, 2000 at 10:12:13PM -0500, [EMAIL PROTECTED] wrote:
> If I have to ports that I wait for data on how can I put them in a while
or
> forever loop without locking up the console. If I had a if statement
> testing data received.
That depends on the type of port and the version of REBOL you use. Assuming
tcp, udp or serial ports opened with /direct, you can wait for multiple
ports
with
wait [port1 port2]
which returns one of the ports if it has data, none otherwise. To get a
block
of all ports returned instead of just a single port use wait/all (latest
experimental version only).
To just poll ports without blocking add a timeout of zero, i.e. try
wait [port1 port2 0]
Using a timeout of zero to poll only works with some old (pre-2.3) versions
of REBOL (on some platforms) and with the latest experimental versions (on
all
platforms), but not with REBOL 2.3.
Other types of ports currently do not support 'wait. Higher-level network
ports (HTTP etc.) will probably support it in one of the next experimental
versions, when opened with /direct.
You may also want to look at the no-wait refinement for 'open. It
guarantees that 'copy on a port never blocks, even if there is no data
available on it (latest experimental version only).
--
Holger Kruse
[EMAIL PROTECTED]