2016-03-03 105 views
1

我正在通過python websocket上的Autobahn的應用程序。 我發現了一個問題,如果我再打斷一次後重新啓動我的服務器代碼我的服務器代碼會送我的錯誤,如:CannotListenError:無法聽任何:9008:[Errno 98]地址已在使用

2016-03-03 13:20:34+0530 [-] Log opened. 
2016-03-03 13:20:34+0530 [-] Traceback (most recent call last): 
2016-03-03 13:20:34+0530 [-] File "TestServer.py", line 23, in <module> 
2016-03-03 13:20:34+0530 [-]  reactor.listenTCP(9008, factory) 
2016-03-03 13:20:34+0530 [-] File "/home/ddserver/python1/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 478, in listenTCP 
2016-03-03 13:20:34+0530 [-]  p.startListening() 
2016-03-03 13:20:34+0530 [-] File "/home/ddserver/python1/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 984, in startListening 
2016-03-03 13:20:34+0530 [-]  raise CannotListenError(self.interface, self.port, le) 
2016-03-03 13:20:34+0530 [-] twisted.internet.error.CannotListenError: Couldn't listen on any:9008: [Errno 98] Address already in use. 

我的錯誤理解是有其背後甚至中斷後上運行的一些基本服務服務器,但如何清除所有這些端口?

回答

1

你說的很對,你的服務即使在你中斷之後也會繼續運行。您需要檢查在該端口上運行的進程並手動殺死它。 您可以使用命令:的ps aux尋找你的流程和使用殺它:殺-9 或者你可以找到幫助here

+1

其簡單的使用命令 「定影-k -n TCP 」 –

相關問題