5

I am not able to kill process bound to 8000 port, due to which I am not able to start HTTP server. This is in reference to question Start HTTP/HTTPS server, python -m SimpleHTTPServer

C:\>taskkill /f /pid 4
ERROR: The process with PID 4 could not be terminated.
Reason: Access is denied.

Even killing by below is not working which I found somewhere.

C:\>taskkill /f /s localhost /pid 4
ERROR: The process with PID 4 could not be terminated.
Reason: Access Denied.

PID 4 is system process, what might be running on there, how do I stop it, why are other ports is a similar fashion listening.

C:\>netstat -ab

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            garg10may-PC:0         LISTENING
  RpcSs
 [svchost.exe]
  TCP    0.0.0.0:443            garg10may-PC:0         LISTENING
 [vmware-hostd.exe]
  TCP    0.0.0.0:445            garg10may-PC:0         LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:902            garg10may-PC:0         LISTENING
 [vmware-authd.exe]
  TCP    0.0.0.0:912            garg10may-PC:0         LISTENING
 [vmware-authd.exe]
  TCP    0.0.0.0:8000           garg10may-PC:0         LISTENING
 Can not obtain ownership information
Community
  • 1
  • 1
garg10may
  • 5,794
  • 11
  • 50
  • 91

3 Answers3

8

if you're in Windows this might help you, the port 80 is usually being used by this service: "World Wide Web Publishing Service", open "Services" in the Control Panel and stop it

Gonza Piotti
  • 707
  • 10
  • 10
2

As per python documentation the http.server module can also be invoked directly using the -m switch of the interpreter with a port number argument. Similar to the previous example, this serves the files relative to the current directory.

python -m http.server 8000

In case your port 8000 is already is being used just change it to another no.

python -m http.server 5000

It's not a good idea to arbitrarily just kill processes and more over system processes.

Matt
  • 27,170
  • 6
  • 80
  • 74
User
  • 483
  • 4
  • 19
1

Don't do this - there is a reason why you are not able to kill it, because you didn't start it. Instead pass another port number:

For Python 3:

python -m http.server 8080

For Python 2:

python -m SimpleHTTPServer 8080
Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • Yes able to start on another port, but still curious what might be running on that port and it that case also I should be able to kill that. – garg10may Sep 21 '14 at 10:55