首先我尝试了SocketServer 类。然后我才知道 SocketServer 在 Python2 中是可用的。对于 Python3,您需要将其设为小写,例如 socketserver。我正在尝试实现一个可以响应多个线程并且不会阻止调用的套接字服务器。
服务器代码如下
class ForkingServer(socketserver.ForkingMixIn, socketserver.TCPServer):
pass
最佳答案
哦,我刚刚从屏幕截图中了解到您使用的是 Windows。 ForkingMixIn
类在 Windows 上不可用,因为 Windows 上没有 fork()
。这个也提到in the docs .
关于python - 属性错误 : module 'socketserver' has no attribute 'ForkingMixIn' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47074315/