Link to home
Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America

asked on

how to Kill my thread

I am running a thread that constantly listen on my port but the problem is when I shut the program down the thread may continue to run so when I restaart I get an error ... Im reading on the web I should kill the thread but ask it to stop but I cant find any examples

class ThreadClass(threading.Thread):
    def run(self):

        host = ''
	port = 51269
	backlog = 5
	size = 1000000
	addr = (socket.gethostname(), port)
	
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.bind((addr))
	s.listen(backlog)

Open in new window

     
      
SOLUTION
Avatar of defc0n1
defc0n1
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of gelonida
gelonida
Flag of France image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Dolamite Jenkins

ASKER

Thanks