尽管我将套接字设置为非阻塞,但 seclect() 函数仍然被阻塞。请帮我。
这是我的代码:
import socket
import select
if __name__ == '__main__':
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind(("localhost",9006))
server.listen(10)
server.setblocking(False)
inputs = [server]
while True:
try:
a,b,c = select.select(inputs, [], [])
except Exception:
print ("exception")
print ("Timeout")