2009-10-31 26 views
0

我試過http://www.rebol.net/docs/async-examples.html的示例,但它不起作用。rebol打開沒有改進稱爲異步

port-spec: tcp://www.rebol.net:80 

http-request: {GET/
User-Agent: REBOL/Core 
Connection: close 

} 

client: context [ 
    data: make binary! 10000 
    handler: func [port action arg] [ 
     switch action [ 
      read [ 
       append data copy/part port arg 
       print ["-- read" arg "bytes" length? data "total"] 
      ] 
      write  [print "-- writing (sending)"] 
      write-done [print "-- done with write"] 
      close [ 
       print ["-- done with read" length? data] 
       close port 
       print ["-- closed port, press RETURN to quit"] 
      ] 
      init  [print "-- port initialized"] 
      open  [print "-- opened" insert port http-request] 
      address [print ["-- address lookup:" arg]] 
      error  [print ["-- error:" mold disarm :arg] close port] 
     ] 
    ] 
] 

p: open/direct/binary/async port-spec get in client 'handler 
input ; (wait for user console input before closing) 
attempt [close p] 

回答

1

/async前一段時間被刪除。如果你想使用異步,你將不得不使用Gabriele和其他人的異步協議。