• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# .NET Thread refuses to abort

## Recommended Posts

I've got a thread started,
_listenthread = new Thread(new ThreadStart(WaitForConnection));

and that thread does this
_socket = _tcplistener.AcceptSocket();
_timeoutcount = 0;
ThrowConnected();

What's wrong is that no matter what I do, I can't make this thread stop. I called _listenthread.Abort(), _listenthread = null, Application.ExitThread() and tried just Application.Exit() But whatever I do, when I close my form the application keeps running. It only works if I comment out _socket = _tcplistener.AcceptSocket(); so I know it has to do with that. Anybody know how to abort this process correctly? EDIT: ok, I figured it out. All I had to do was set _listenthread.IsBackground = true; Sorry for the trouble. [edited by - Trashcann on April 3, 2004 2:39:13 AM]