1

I ran the following python code in my git bash for windows to create a web socket and i am unable to kill the process with ctrl + z. Even after restarting the git bash the process is running as when i tried reinstalling git bash it gave me error that bash(PID 10436, closing required) :

import socket

host = socket.gethostname()

port = 8080

print('host: ',host,'port: ',port)

s = socket.socket()

s.bind((host,port))

print('started')

s.listen(1)

connection , address = s.accept()

print(address,"is online")

enter image description here

It would be really helpful if i could get to know the reason behind this.

zxcv
  • 79
  • 1
  • 6

1 Answers1

1

Killing a process is done usually with Ctrl+C (not Z, which is more for background tasks)

You should try first to kill pid 16872, with taskkill /F /pid 16872 (in a regular CMD)

Then see this recent Python websocket example for another approach to your code.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250