使用说明书示例之一,我正在尝试在 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
我怎样才能更好地处理这个问题?
把它放在你的任一块中
either any [
not incoming-from-remote: copy data
"" = incoming-from-remote
] [
attempt [
close data
remove find waitports data
]
] [
print ..
]