[REBOL] Creating a Server Port Cookbook example - newbie question
From: dgarrard::nufocusinc::com at: 13-Oct-2003 19:08
One of the examples in the "Cookbook", authored by Paul Tretter is "Creating
a Server Port"
http://www.rebol.net/cookbook/recipes/0034.html
Server Code:
listen: open tcp://:12345
waitports: [listen]
forever [
data: wait waitports
either same? data listen [
active-port: first listen
append waitports active-port
][
incoming-from-remote: first data
print incoming-from-remote
]
]
I have set this up and it works as expected if I manually type into a
remote console
the data insertion calls he suggests:
from-remote: open tcp://localhost:12345
insert from-remote "test"
test
arrives at the server...
But if I create the following script:
REBOL [
Title: "Open a Server Port - Now connect with Client 1"
Date: 11-Oct-2003
]
from-remote: open tcp://localhost:12345
insert from-remote "test"
quit
it crashes the "server" if I run it by simply double-clicking.
Server reports:
** Script Error: Out of range or past end
** Where: forever
** Near: incoming-from-remote: first data
comment [print incoming-from-remote]
>>
How do I gracefully exit out of my client script without crashing the
server. Or does the server need more complete error handling?
Thanks in advance...
D Garrard