system/ports/wait-list usage
[1/5] from: rebol-list2::seznam::cz at: 23-Dec-2002 2:33
Hello rebol-list,
as I'm experimenting with ports now, I thoght it would be good to
use the system/ports/wait-list block as the main wait block instead
of my own block variable, but it looks, that it's not possible to
insert time into system/ports/wait-list block:
>> p: open/direct/no-wait tcp://:8080
>> wait-list: [p 0:0:1]
== [p 0:00:01]
>> wait/all wait-list
== none ;the timeouted event
>> system/ports/wait-list: [p 0:0:1]
== [p 0:00:01]
>> wait/all system/ports/wait-list
** Script Error: Invalid argument: p
** Near: wait/all system/ports/wait-list
>> system/ports/wait-list: reduce [p 0:0:1]
== [
make object! [
scheme: 'tcp
host: none
port-id: 8080
user: none
pass: none
...
>> wait/all system/ports/wait-list
** Script Error: Invalid argument: 0:00:01
** Near: wait/all system/ports/wait-list
is there any reason for that? How to use the system/ports/wait-list
with possibility to have timeouts if the system is iddle (so I can do
some tasks)
is there already some new documentation on ports?
is it better to use port's awake function (in the handler object) to
process some data or to use block with port and handler function as
it's used in the dispatch (I've never used the dispatch function anyway)
I would found it useful but it looks that it's not possible to use the
awake function on some type of port schemes (for example console)
=( Oliva David )=======================( [oliva--david--seznam--cz] )==
=( Earth/Europe/Czech_Republic/Brno )=============================
=( coords: [lat: 49.22 long: 16.67] )=============================
[2/5] from: dockimbel:free at: 24-Dec-2002 11:53
Hi,
Try with :
>> p: open/direct/no-wait tcp://:8080
>> insert system/ports/wait-list p
>> insert system/ports/wait-list 0:0:1
>> wait/all []
AFAIK, there's no new docs on port!
Awake is the right way if you want to cleanly integrate with the main REBOL
event loop. I made a quick test with an 'awake handler on a 'console
port: 'awake doesn't seem to be called.
HTH,
-DocKimbel
En réponse à RebOldes <[rebol-list2--seznam--cz]>:
[3/5] from: g:santilli:tiscalinet:it at: 24-Dec-2002 12:05
Hi RebOldes,
On Monday, December 23, 2002, 2:33:59 AM, you wrote:
R> is there any reason for that?
Because it does not have much sense to have a timeout there. :-)
R> How to use the system/ports/wait-list
R> with possibility to have timeouts if the system is iddle (so I can do
R> some tasks)
insert tail system/ports/wait-list p
wait 0:00:01
R> is it better to use port's awake function (in the handler object) to
I think so, when possible. I find it much more cleaner.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[4/5] from: maarten:koopmans:surfnet:nl at: 24-Dec-2002 13:04
> insert tail system/ports/wait-list p
Optimizing, aren't we ;-)
--maarten
[5/5] from: rebol-list2:seznam:cz at: 3-Jan-2003 14:08
Hello Gabriele,
Tuesday, December 24, 2002, 12:05:41 PM, you wrote:
GS> Hi RebOldes,
GS> On Monday, December 23, 2002, 2:33:59 AM, you wrote:
R>> is there any reason for that?
GS> Because it does not have much sense to have a timeout there. :-)
Of course there is the reason... I need to call some functions and
not to stop the wait cycle
R>> How to use the system/ports/wait-list
R>> with possibility to have timeouts if the system is iddle (so I can do
R>> some tasks)
GS> insert tail system/ports/wait-list p
GS> wait 0:00:01
R>> is it better to use port's awake function (in the handler object) to
GS> I think so, when possible. I find it much more cleaner.
As I was working on IRC client which is able to handle more
connections at once, I made some tests.... first I made irc-protocol and
then used my own wait-list and port-handlers-block (simillar as in the
Rugby), just because the behavior of the system/ports/wait-list is strange.
It was working, but after some time, excet the last irc connection the
other were closed somehow.
So I made it as simple open/lines/direct/no-wait (without protocol) and it's working.
I think we will have to wait since the async-ports will be finished and Carl
will give us some documentation (for example what exactly means the
port-flags and how works the event cycle - what's going on when we do
wait wait-list)
GS> Regards,
GS> Gabriele.
GS> --
GS> Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
GS> Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
=( Oliva David )=======================( [oliva--david--seznam--cz] )==
=( Earth/Europe/Czech_Republic/Brno )=============================
=( coords: [lat: 49.22 long: 16.67] )=============================