Need to close python socket / Find the current running server on my dev environment

前端 未结 3 934
-上瘾入骨i
-上瘾入骨i 2020-12-12 16:42

I\'m trying to learn python (using the Flask micro-framework) and I am confused because somewhere in my code i\'m keeping the server open I believe.

I spin up my ser

相关标签:
3条回答
  • 2020-12-12 17:05

    To kill the python process which is listening on port 5000 :

    sudo lsof -i :5000 | grep "python" | cut -d " " -f3 | xargs kill -9

    0 讨论(0)
  • 2020-12-12 17:20

    If you use linux you can use lsof to find out which process is using a given port, you might have to install it first though, usage is pretty simple:

    lsof -i :5000
    
    0 讨论(0)
  • 2020-12-12 17:32

    You're probably closing the server using Ctrl-Z. If so, use Ctrl-C instead.

    0 讨论(0)
提交回复
热议问题