I'm calling tcpListener.AcceptTcpClient()
inside its own thread. Because this blocks forever, the thread doesn't exit when my form closes. I tried calling listenThread.Abort()
, but the thread doesn't exit. It's stuck on AcceptTcpClient()
.
How can I get my whole program to shutdown when I close the main form?