在 python 中,为什么 select.select 要求我在一个循环中休眠?

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

我正在写一个套接字服务器。在 while 循环中,

while True:
    rlist, wlist, _ = select.select([sock], [sock], [])

        for rsock in rlist:
            new_data = rsock.recv(RCV_SIZE)

        for wsock in wlist:
            wsock.send(other_data + TERMINATOR)

        time.sleep(0.1)

我注意到当我排除 time.sleep 函数时,没有数据进来。为什么会这样?

python sockets event-loop
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.