I would like to kill programatically a thread which is running in a while(true) loop and listening for connections infinetely and since listening is a blocking method I cant simply set the loops statemenet into false. My application is generally swapping networks periodically when connected launches a server to listen for connections, so when it does swap to another network I am afraid that the old server will become a zombie and just stuck there since on the new network the server is bound on different IP than the one it had previously.
PS. will binding the server to localhost not require its reset after network change?