The REBOL3 network is asynchronous by default, so the code in REBOL3 should look like this:
client: open tcp:
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
Based on: http://www.rebol.net/wiki/TCP_Port_Examples
Oldes source
share