Python [Errno 98] Address already in use

前端 未结 9 2652
一个人的身影
一个人的身影 2020-11-27 10:35

In my Python socket program, I sometimes need to interrupt it with Ctrl-C. When I do this, it does close the connection using socket.close().

9条回答
  •  执笔经年
    2020-11-27 10:53

    Nothing worked for me except running a subprocess with this command, before calling HTTPServer(('', 443), myHandler):

    kill -9 $(lsof -ti tcp:443)
    

    Of course this is only for linux-like OS!

提交回复
热议问题