I have a udp client that is listening for multicast messages. When it gets a message the message is parsed and the client resumes listening. If the application is shutdown while the socket.ReceiveFrom method is blocking, how can I interrupt this process and continue?
I have the socket running on a different thread and I've tried to issue an interrupt to that thread and then join, but the interrupt doesn't work the socket.ReceiveFrom never returns unless it gets a message.
I have also tried setting a timeout on the socket, but this isn't ideal since it generates an exception on timeout and since I'm always listening I will be generating a ton of timeouts, catching them and then go back to listening.
Any ideas what i can try here?