[REBOL] A couple of things regarding ports
From: rebol:svendx:dk at: 15-Sep-2000 18:55
Hello,
I have a couple of questions regarding the latest beta (REBOL/Core 2.4.35.1.1)
I'm doing a multi connection server using raw tcp ports.
The core loop goes like this:
(I've stripped some logging, etc - so I might have broken
something :-)
serve: func [
/local ready-list wait-list pos
] [
wait-list: []
while [(length? port-list) > -1] [
clear wait-list
foreach [port obj] port-list [append wait-list port]
append wait-list 0:00:05
ready-list: wait/all wait-list
if block? ready-list [
foreach port ready-list [
log 'debug [port/local-ip port/local-port "<->"
port/remote-ip port/remote-port]
pos: find port-list port
if found? pos [
pos/2/handle-ready
]
]
]
]
]
As you can see, each port is associated with an object (handler)
which has a function, 'on-ready.
The trouble is, that once in a while, handle-ready is called on a
listen port that really hasn't got any incomming connections ???
[first port] hangs, and there's no timeout...
(all listen ports are openend with open/no-wait tcp://:port-id )
have I done anything stupid, or is it a bug ??
(I still need to do some experimenting with different refinements
to open, etc)
On a related topic: I'd really like to get rid of the association list
(port-list). probing the ports showed a word called 'locals (value:
none), anyone know of any problems using it to point to the handler?
Best regards
Thomas Jensen