如何用python中的epoll()替换select()?

问题描述 投票:1回答:1

我正在编程python Web套接字聊天服务器。我使用功能select()使服务器工作,以侦听客户端,但是当我在Windows上连接超过512个客户端或在Linux上连接1024个客户端时,服务器崩溃。经过研究,我发现这是系统限制,我需要使用poll()或epoll()进行更多连接。

这是使用select()的代码的一部分,我需要使用epoll()或poll()函数进行重写:

from select import select
rList, wList, xList = select(listeners, writers, listeners, interval)
for ready in wList:
    function1()
for ready in rList:
    function2()
for failed in xList:
    function3()

我如何使用epoll()或poll()做同样的事情?仍然需要在上面调用这些函数。

python python-3.x select polling epoll
1个回答
0
投票

我相信应该是

© www.soinside.com 2019 - 2024. All rights reserved.