【发布时间】:2012-12-15 06:20:49
【问题描述】:
我目前正在做一个在 mac os 山狮上创建 TCP 服务器的项目。我写了一个脚本叫:Server.py
在这个 python 脚本中,我使用了 twisted 来监听端口 80,如下所示:
reactor.listenTCP(80, factory)
reactor.run()
我怎么会遇到这样的错误:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/posixbase.py", line 436, in listenTCP
p.startListening()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/tcp.py", line 641, in startListening
raise CannotListenError, (self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on any:80: [Errno 13] Permission denied.
我在想是不是因为 tcp.py 脚本对管理员用户有错误的权限?或者有没有办法在端口
欢迎任何更好的解决方案。
【问题讨论】: