python - 属性错误 : module 'socketserver' has no attribute 'ForkingMixIn'

标签 python sockets python-multithreading

首先我尝试了SocketServer 类。然后我才知道 SocketServer 在 Python2 中是可用的。对于 Python3,您需要将其设为小写,例如 socketserver。我正在尝试实现一个可以响应多个线程并且不会阻止调用的套接字服务器。

服务器代码如下

class ForkingServer(socketserver.ForkingMixIn, socketserver.TCPServer):
  pass

enter image description here 但它给出了上述错误。有人知道吗?

最佳答案

哦,我刚刚从屏幕截图中了解到您使用的是 Windows。 ForkingMixIn 类在 Windows 上不可用,因为 Windows 上没有 fork()。这个也提到in the docs .

关于python - 属性错误 : module 'socketserver' has no attribute 'ForkingMixIn' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47074315/

相关文章:

python - 如何在Python 3中的集合中的特定位置/索引中添加值?

C# Socket编程,关闭窗口

python - 用asyncio转换一个简单的多线程程序

OpenCV 中的 Python 线程问题

python - 使用线程模块时,Django 在完成测试后不退出

python - 类型错误:不支持的操作数类型 - : 'int' 和 'list'

python - 如何在mysql中搜索有多少重复项并进行比较

python - 获取文件的 MD5 哈希值非常慢

linux - 套接字绑定(bind)失败 errno = 99

c - 连接拒绝错误的原因可能是什么?