bioserrors Posted July 30, 2003 Posted July 30, 2003 I have a multithreaded application in which I would like a UDP socket to receive data whenever something is sent. As if it's "listening" for data. But if I want to quit the application before any data is sent to the UDP socket, I need to close the thread that is handling the UDP socket. But since UDP.Receive() method blocks execution of that thread until data arrives, how do I gracefully close the thread? Should I send a "fake" message to it so that it stops blocking? Just looking for input... thanks! PS~ I'm using VB.NET, but will understand syntax from other languages. Quote
Administrators PlausiblyDamp Posted July 30, 2003 Administrators Posted July 30, 2003 Not sure if it will help in this case but if you set the IsBackground property of a thread to true then it should be killed off when the app closes. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bioserrors Posted July 30, 2003 Author Posted July 30, 2003 Thank you! While not necessarily the most graceful solution, using this technique certainly works! -Dave 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.