【问题标题】:Asynchronous raw socket in python 3.5python 3.5中的异步原始套接字
【发布时间】:2015-12-06 15:59:49
【问题描述】:

我试图以异步方式在 python 3.5 上使用原始套接字。

我找到了我们可以使用原始套接字的 asyncore 库,但它似乎已被弃用,asyncio 库是要走的路。

但是在阅读文档之后,似乎 asyncio 不支持原始套接字。

您知道其他库或实现此目标的其他方法吗?

【问题讨论】:

标签: python asynchronous python-asyncio raw-sockets asyncore


【解决方案1】:

asyncio 确实为原始套接字提供了公共 API;但是,在大多数情况下,使用 Transport/Protocol 抽象可能会更好。

loop.sock_* 协程实现低级套接字操作。如果你想要更多的控制,你可以watch the file descriptor for events 然后相应地从套接字读取。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-15
    • 2017-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-19
    • 2013-02-09
    相关资源
    最近更新 更多