music7611 Posted January 31, 2004 Posted January 31, 2004 I have a network waiting for a connection on its own thread. (TcpListener.AcceptSocket()). Anywho, I need the thread to be able to abort while this is happening. I tried doing Thread.Abort(), but it doesn't work! I am using C#. Thankyou for your time and energy in this matter. Quote
NK2000 Posted January 31, 2004 Posted January 31, 2004 maybe you should stop the listener first, normally Thread.Abort should work do you use a try and catch ? Quote
music7611 Posted January 31, 2004 Author Posted January 31, 2004 I have a try and chatch thingy, and it does catch exception ThreadAbortException, but when I used the debugger, I found that that part of the code didn't even execute. Even when I called Thread.Abort. Quote
music7611 Posted January 31, 2004 Author Posted January 31, 2004 Wait! How do you stop the listener? Quote
*Experts* Bucky Posted January 31, 2004 *Experts* Posted January 31, 2004 TcpListener.Stop(), perhaps? Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
music7611 Posted January 31, 2004 Author Posted January 31, 2004 How do you call TcpListener.Stop() when it is still in the function, TcpListener.AcceptSocket()? Quote
NK2000 Posted February 1, 2004 Posted February 1, 2004 for that reason i dont use it that way i really prefer asynchronous server there is also an example in the msdn for that way Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.