I have a thread when it is run it has an infinite loop. When another thread is stopped, I wish to reset all the threads again, There threads have sockets that transfer data between each other. I am using
node1._Thread__stop()
function to stop the thread runing, but when I try to create a new thread with the same name:
node1 = node.node(8081,8082,token,1,"Node A",0)
node1.start()
It gives out an error
[Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
I am not sure if the stop function worked on the threads, because I have a timeout clause for a socket that if it doesn't receive anything to print timeout. This prints after the error occured.
What would be a better reset of a thread/socket