Thanks Gabriele, that helped.
I didn't realize that read-io returned a value.  I don't remember seeing
anything about it in the documentation.  Ohh well...  Back to programming
and frustration...



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 29, 2000 9:38 AM
Subject: [REBOL] Re: receiving data of unknown sizes through a port


> Hello [EMAIL PROTECTED]!
>
> On 29-Apr-00, you wrote:
>
>  m> I want to create a server that receives files (or any data) of
>  m> unknown sizes through a port. How do I know when the EOF is
>  m> reached or if the other end has closed the port?
>
> If the client closes the port, you can simply:
>
>  *** server side ***
>
>  port: open/binary tcp://:2000
>  forever [
>    io-port: first port
>    wait io-port
>    data: copy io-port
>    ; etc.
>    close io-port
>  ]
>
> If you really need read-io, then notice that it returns 0 if the
> client closed the port and there is no data to read.
>
> If the client does not close the port, then you don't have any way
> to know when it has finished sending data, if it doesn't tell you
> somehow. The client should perhaps send the size of the data it's
> sending first, or use a special character or sequence to mark the
> end of the data.
>
> Regards,
>     Gabriele.
> --
> Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
> Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
>

Reply via email to