SocketServer.ThreadingTCPServer - Cannot bind to address after program restart

前端 未结 2 1482
长发绾君心
长发绾君心 2020-12-10 13:18

As a follow-up to cannot-bind-to-address-after-socket-program-crashes, I was receiving this error after my program was restarted:

socket.error: [Errno

2条回答
  •  余生分开走
    2020-12-10 13:59

    The above solution didn't work for me but this one did:

       SocketServer.ThreadingTCPServer.allow_reuse_address = True
       server = SocketServer.ThreadingTCPServer(("localhost", port), CustomHandler)
       server.serve_forever()
    

提交回复
热议问题