Mac OS X 환경에서 소켓 프로그래밍을 사용하여 샘플을 만드는 방법은 http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server입니다.Python twisted reactor - 주소가 이미 사용 중입니다.
reactor.listenTCP (80, 공장)에 80이라는 글을 쓰고 있습니다.
File "server.py", line 10, in <module>
reactor.listenTCP(6, factory)
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 48] Address already in use.
소스 코드는 다음과 같다 : 오류를 받고 난 server.py 파일을 실행 ,
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
class IphoneChat(Protocol):
def connectionMade(self):
self.factory.clients.append(self)
print "clients are ", self.factory.clients
def connectionLost(self, reason):
self.factory.clients.remove(self)
factory = Factory()
factory.protocol = IphoneChat
factory.clients = []
reactor.listenTCP(80, factory)
print "Iphone Chat server started"
reactor.run()
내가 다른 포트 없음을 추천 등을 사용하고 있다면, 그것은 잘 작동 . 방금 알고 싶었던 동일한 응용 프로그램에 포트 80을 어떻게 사용할 수 있습니까?
포트 80은 HTTP 프로토콜 용으로 다시 설정됩니다. 이 포트에서 프로세스가 실행 중인지 확인하십시오. Apache 같은 일부 HTTP 서버일까요? –