0

我尝试了示例http://www.rebol.net/docs/async-examples.html但它不起作用。

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]
4

1 回答 1

1

/async 不久前被删除。如果要使用异步,则必须使用 Gabriele 和其他人的异步协议。

于 2009-10-31T19:30:25.050 回答