Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: multitasking

From: gchiu:compkarori at: 11-Feb-2004 1:16

Will Arp wrote.. apparently on 10-Feb-2004/22:01:11+1:00
>Hi all, > >can someone please point me to some >example using async-protocol with /core >
[ REBOL [ Title: "Test async protocol - HTTP download" Author: "Gabriele Santilli" ] do %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 /fg/anen.jpg HTTP/1.0^M^JHost: www.3dwallpaper.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.3dwallpaper.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." ] ] -- Graham Chiu http://www.compkarori.com/cerebrus