【发布时间】:2017-12-22 18:09:44
【问题描述】:
使用扭曲书中的示例代码:echoserver.py 2-1。我不断收到此错误
第 980 行,在 startListening 中 引发CannotListenError(self.interface,self.port,le)twisted.internet.error.CannotListenError:无法监听任何:8000: [WinError 10048] 每个套接字地址只能使用一次 (协议/网络地址/端口)通常是允许的。
代码:
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
reactor.listenTCP(8000, EchoFactory())
reactor.run()
关于如何修复错误或为什么我的计算机认为此套接字地址有多个用法的任何想法?对网络完全陌生。
【问题讨论】:
-
你在 8000 端口上还有其他设置吗?尝试其他端口。
-
@Ivan86 如何查看?
标签: python networking twisted