djones7936
Programmer
Hello,
I've got a run away thread!
I am making a very simple program which accepts connections on post 80 (HTTP), sends an HTTP header and a short webpage, then closes the connection. (Essentially, a very simple web server.) I have a TcpListener in a separate class which is accessed using a thread. I'm using a thread because normally, the user interface freezes until there is a request for a webpage.
While the program "listens", the code in the thread stays at the tcpListener.AcceptSocket() line, and waits for a webpage request.
The program appears to run okay, and the webpage displays properly, but the thread still runs after the close button is pressed. I used the thread.Abort(); command, but the thread seems to keep going as if the command was never executed.
I put thread.Abort(); in the Dispose subroutine of my program. When the program closes, the thread should abort/stop, but it doesn't.
Is thread.Abort() supposed to stop then destroy the thread? Has anyone experienced this problem, or know what might cause it?
Thanks for any input!
-Dave
I've got a run away thread!
I am making a very simple program which accepts connections on post 80 (HTTP), sends an HTTP header and a short webpage, then closes the connection. (Essentially, a very simple web server.) I have a TcpListener in a separate class which is accessed using a thread. I'm using a thread because normally, the user interface freezes until there is a request for a webpage.
While the program "listens", the code in the thread stays at the tcpListener.AcceptSocket() line, and waits for a webpage request.
The program appears to run okay, and the webpage displays properly, but the thread still runs after the close button is pressed. I used the thread.Abort(); command, but the thread seems to keep going as if the command was never executed.
I put thread.Abort(); in the Dispose subroutine of my program. When the program closes, the thread should abort/stop, but it doesn't.
Is thread.Abort() supposed to stop then destroy the thread? Has anyone experienced this problem, or know what might cause it?
Thanks for any input!
-Dave