[REBOL] Re: Network Ports with no-wait option
From: holger::rebol::com at: 6-Dec-2000 17:23
On Wed, Dec 06, 2000 at 12:40:41PM -0600, Paul E Tretter wrote:
> Ok I'm stumped (not unusual), I got problems using multiple ports.
>
> Here is the delima - I got one port that is open and put into a block.
>
> waitports: [myportscheme]
>
> This block will be modiflied when information comes in on that port so that the waitports
block is updates with new ports as determined by incoming requests. My wait statement
looks similiar to:
>
> waitport: wait waitports
>
> All my ports use the following construction:
>
> open/lines/direct/no-wait "whatever port scheme"
>
> The problem is how do I read determine when a port that was opened is now closed on
the other end. The docs say to copy first port and filter for the "none" response in
order to close the port.
Read data from the port with
data: copy port
If data is none then the other end has been closed. Otherwise you get the available data.
For /lines ports, data is always returned as a block of lines. If no data is available
at
the port (but the other end has not been closed yet), then an empty block is returned.
--
Holger Kruse
[holger--rebol--com]