使用One of the cookbook examples,我试图在Rebol2中创建一个这样的服务器:
listen: open tcp://:9999
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
]
]
使用客户端我可以通过插入来连接和发送消息,但是当我从客户端关闭端口时,我在服务器上收到以下错误:
** Script Error: Out of range or past end
** Where: forever
** Near: incoming-from-remote: first data
print incoming-from-remote
我怎样才能更好地处理这个问题?
答案 0 :(得分:0)
把它放在你的任一块
中either any [
not incoming-from-remote: copy data
"" = incoming-from-remote
] [
attempt [
close data
remove find waitports data
]
] [
print ..
]