[REBOL] Re: A couple of things regarding ports
From: g::santilli::tiscalinet::it at: 16-Sep-2000 18:46
Hello [rebol--svendx--dk]!
On 15-Set-00, you wrote:
r> I'm doing a multi connection server using raw tcp ports.
First of all, let me note that:
>> system/version
== 2.4.36.1.1
>> source dispatch
dispatch: func [
{Wait for a block of ports. As events happen, dispatch port handler blocks.}
port-block [block!] {Block of port handler pairs (port can be timeout too).}
/local ports awake timeblk result
][
ports: copy []
foreach [port job] port-block: reduce port-block [
if any [number? port time? port] [if none? timeblk [timeblk: :job]]
append ports port
]
forever [
either awake: wait/all ports [
if foreach item awake [
set/any 'result do select port-block item item
if all [value? 'result 'break = :result] [break/return true]
] [break]
] [do :timeblk]
]
]
there's a new function available. :-)
r> The trouble is, that once in a while, handle-ready is called
r> on a listen port that really hasn't got any incomming
r> connections ??? [first port] hangs, and there's no timeout...
It's probably a bug.
r> On a related topic: I'd really like to get rid of the
r> association list (port-list). probing the ports showed a word
r> called 'locals (value: none), anyone know of any problems
r> using it to point to the handler?
I think you can use it freely in raw TCP ports. It is used by
protocol handlers to store the data they need.
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/