Rebol Multitasking with Async: why do I get Invalid port spec
Posted
by Rebol Tutorial
on Stack Overflow
See other posts from Stack Overflow
or by Rebol Tutorial
Published on 2009-10-31T10:11:15Z
Indexed on
2010/06/09
1:02 UTC
Read the original article
Hit count: 337
rebol
I tried http://www.mail-archive.com/[email protected]/msg19437.html (I just changed to www.reboltutorial.com) :
do http://www.rebol.it/giesse/async-protocol.r
handler: func [port [port!] state [word! error!] /local tmp cmd] [
if error? :state [print mold disarm state return true]
switch state [
connect [
; do HTTP request
insert port {GET /files/2009/10/word.png HTTP/1.0^M^JHost:
www.reboltutorial.com^M^J^M^J}
false
]
read [false]
write [false]
close [
; get data
data: copy port
close port
;print copy/part data find data "^M^J^M^J"
data: to binary! find/tail data "^M^J^M^J"
other/image: attempt [load data]
other/text: ""
show other
false
]
]
]
port: open async://www.reboltutorial.com:80
port/awake: :handler
view layout [
across me: box 100x100 random 255.255.255 0:00:00.5 feel [
engage: func [f a e] [
if a = 'time [
me/color: random 255.255.255
show me
]
]
]
other: box 100x100 255.255.255 "Downloading image..." Return
Area 208x100 "You can type here while downloading."
]
]
But I'm getting this error:
>> port: open async://reboltutorial.com:80
** Access Error: Invalid port spec: async://reboltutorial.com:80
** Near: port: open async://reboltutorial.com:80
>> port/awake: :handler
** Script Error: port has no value
** Near: port/awake: :handler
© Stack Overflow or respective owner