我在REBOL2中有以下代码:
port: open/direct tcp://localhost:8080
insert port request
result: copy port
close port在REBOL3中什么是等价的?
发布于 2015-02-12 15:14:10
默认情况下,REBOL3网络是异步的,因此REBOL3中的代码必须如下所示:
client: open tcp://localhost:8080
client/awake: func [event /local port] [
port: event/port
switch event/type [
lookup [open port]
connect [write port to-binary request]
read [
result: to-string port/data
close port
return true
]
wrote [read event/port]
]
false
]
wait [client 30] ;the number is a timeout in seconds
close client 基于:Examples
编辑:上面的链接已经不存在了,但是它被传输到GitHub的wiki:https://github.com/revault/rebol-wiki/wiki/TCP-Port-Examples
https://stackoverflow.com/questions/28480786
复制相似问题