rebol open 没有称为异步的细化

发布于 2024-08-09 08:04:19 字数 1227 浏览 2 评论 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]

I tried the example http://www.rebol.net/docs/async-examples.html but it doesn't work.

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]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小傻瓜 2024-08-16 08:04:19

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

The /async was removed a while ago. If you want to use async, you'll have to use Gabriele and others' async protocols.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文