[REBOL] Re: Problem: Talking from Rebol to Rebol via socket
From: sqlab::gmx::net at: 23-Feb-2009 15:54
Robert M. Münch wrote:
> Am 23.02.2009, 13:00 Uhr, schrieb sqlab <sqlab-gmx.net>:
>
>> ok, the same example
>> with waiting for events and ping pong messages in a 10 sec forever
>> intervall.
>>
>
> Hi, thanks this now works. Great! :-)
>
You are welcome
> So the only change was on the client using a WAIT.
>
>> This you can do with many sockets too, but then it is more elegant to
>> use awake finctions.
>>
>
functions not finc..
> Yes, it just want to start simple :-)
>
> Some questions regarding time-outs etc.
>
> 1. If I make a connection from the client but don't send anything. Will a
> timeout happen on the server side? Where can I get/set this timeout value?
>
No, you will not get a timeout.
You are using no-wait ports. If you copy from this kind of ports, you
will either get
none -> socket is closed by the peer, better close it too
-> you are reading without data waiting, better read only after you
get an event, showing that something has arrived
your message
-> speaks for itself
Take care that you can get your message in parts.
> 2. What about send/recv timeouts? Can I get/set these as well? Are these
> different than the timeout of 1. (if any at all)?
>
This you have to handle by yourself.
One way to do could be
Keep the time of the last event for each socket,
Define a timeout action, where you compare the actual time with the
last event time and act accordingly
maybe like this;
------------
append connectionlist timeout
either port: wait connectionlist [
act-on-port port
] [
foreach port connectionlist [check-an-act port]
]