troubleshooting Question

how to Kill my thread

Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America asked on
PythonScripting Languages
3 Comments2 Solutions655 ViewsLast Modified:
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)
     
      
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros