[REBOL] Re: waiting on tcp ports

2004-05-23 Thread Gabriele Santilli

Hi Miguel,

On Saturday, May 22, 2004, 4:40:17 PM, you wrote:

ML ready: wait/all [port1 port2 10]

Since  you are using /ALL, READY can be a block with both ports in
it.  So  either  you should remove the /ALL refinement (so that at
most one port will be returned each time), of you should read from
all ports returned.

BTW, I'd recommend not using READ-IO unless really necessary (that
is, unless you are using async-modes). Use COPY instead.

Regards,
   Gabriele.
-- 
Gabriele Santilli [EMAIL PROTECTED]  --  REBOL Programmer
Amiga Group Italia sez. L'Aquila  ---   SOON: http://www.rebol.it/

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: waiting on tcp ports

2004-05-22 Thread Anton Rolls

You are assuming ready is one of the two
ports, however, wait can return none! (when
you get a 10 second timeout).
So check that ready is really a port, like this:

if port? ready [ ... ]

Anton.

 Hi all,
 I have a problem.
 I execute this code:
 port1: open/lines/direct tcp://:4321
 port2: open/lines/direct tcp://:8989
 data: make string! 1000
 
 ready: wait/all [port1 port2 10]
 if ready [
   probe read-io ready data 1000
 ]
   to listen on multiple ports.
 I observe the following error:
 ** Script Error: read-io expected port argument of type: port
 ** Near: probe read-io ready data 1000
 
 How can I read the data when listening on two or more ports?
 
 (the same error with dispatch)
 
 Thanx,
 Miguel Lopez

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.